Merge in 'release/6.0.2xx' changes

This commit is contained in:
dotnet-bot 2022-03-11 01:05:01 +00:00
commit 0a881e8874
61 changed files with 2661 additions and 1063 deletions

View file

@ -392,7 +392,7 @@ stages:
pool:
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCore1ESPool-Svc-Internal
demands: ImageOverride -equals build.windows.10.amd64.vs2017
demands: ImageOverride -equals Build.Windows.10.Amd64.VS2017
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:

View file

@ -201,23 +201,23 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22107.2">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22122.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d</Sha>
<Sha>7215d8265a7fbcd022eb72ff7a6e2048444c985f</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.CMake.Sdk" Version="6.0.0-beta.22107.2">
<Dependency Name="Microsoft.DotNet.CMake.Sdk" Version="6.0.0-beta.22122.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d</Sha>
<Sha>7215d8265a7fbcd022eb72ff7a6e2048444c985f</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="6.0.0-beta.22107.2">
<Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="6.0.0-beta.22122.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>fe5cc1841d12196d94a4ae3b276cb92d8d7ca73d</Sha>
<Sha>7215d8265a7fbcd022eb72ff7a6e2048444c985f</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="6.0.0-servicing.22110.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="6.0.0-servicing.22158.2">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>095aaf95c3d1d10a96db5cb3914632bc0c36db81</Sha>
<Sha>2bd5e08a5ede56b51ea88ac3deecde19c5c520cb</Sha>
<SourceBuildTarball RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceLink.GitHub" Version="1.1.0-beta-21480-02" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">

View file

@ -8,7 +8,7 @@
<VersionMajor>6</VersionMajor>
<VersionMinor>0</VersionMinor>
<VersionSDKMinor>2</VersionSDKMinor>
<VersionFeature>01</VersionFeature>
<VersionFeature>02</VersionFeature>
<VersionPrefix>$(VersionMajor).$(VersionMinor).$(VersionSDKMinor)$(VersionFeature)</VersionPrefix>
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<MajorMinorVersion>$(VersionMajor).$(VersionMinor)</MajorMinorVersion>
@ -19,7 +19,7 @@
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/arcade -->
<MicrosoftDotNetBuildTasksInstallersPackageVersion>6.0.0-beta.22107.2</MicrosoftDotNetBuildTasksInstallersPackageVersion>
<MicrosoftDotNetBuildTasksInstallersPackageVersion>6.0.0-beta.22122.7</MicrosoftDotNetBuildTasksInstallersPackageVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Dependency from https://github.com/dotnet/winforms -->
@ -121,7 +121,7 @@
<NUnit3Templates50PackageVersion>$(NUnit3DotNetNewTemplatePackageVersion)</NUnit3Templates50PackageVersion>
<MicrosoftDotNetCommonItemTemplates50PackageVersion>$(MicrosoftDotNetCommonItemTemplates50PackageVersion)</MicrosoftDotNetCommonItemTemplates50PackageVersion>
<MicrosoftDotNetCommonProjectTemplates50PackageVersion>$(MicrosoftDotNetCommonItemTemplates50PackageVersion)</MicrosoftDotNetCommonProjectTemplates50PackageVersion>
<AspNetCorePackageVersionFor50Templates>5.0.14</AspNetCorePackageVersionFor50Templates>
<AspNetCorePackageVersionFor50Templates>5.0.15</AspNetCorePackageVersionFor50Templates>
<!-- 3.1 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates31PackageVersion>4.8.1-servicing.19605.5</MicrosoftDotnetWinFormsProjectTemplates31PackageVersion>
<MicrosoftDotNetWpfProjectTemplates31PackageVersion>3.1.2-servicing.20066.4</MicrosoftDotNetWpfProjectTemplates31PackageVersion>
@ -129,7 +129,7 @@
<MicrosoftDotNetCommonItemTemplates31PackageVersion>3.1.15</MicrosoftDotNetCommonItemTemplates31PackageVersion>
<MicrosoftDotNetCommonProjectTemplates31PackageVersion>$(MicrosoftDotNetCommonItemTemplates31PackageVersion)</MicrosoftDotNetCommonProjectTemplates31PackageVersion>
<MicrosoftDotNetTestProjectTemplates31PackageVersion>$(MicrosoftDotNetTestProjectTemplates50PackageVersion)</MicrosoftDotNetTestProjectTemplates31PackageVersion>
<AspNetCorePackageVersionFor31Templates>3.1.22</AspNetCorePackageVersionFor31Templates>
<AspNetCorePackageVersionFor31Templates>3.1.23</AspNetCorePackageVersionFor31Templates>
<MicrosoftAspNetCoreComponentsWebAssemblyTemplatesPackageVersion>3.2.1</MicrosoftAspNetCoreComponentsWebAssemblyTemplatesPackageVersion>
<!-- 3.0 Template versions -->
<MicrosoftDotnetWinFormsProjectTemplates30PackageVersion>4.8.0-rc2.19462.10</MicrosoftDotnetWinFormsProjectTemplates30PackageVersion>
@ -172,7 +172,7 @@
or minor release, prebuilts may be needed. When the release is mature, prebuilts are not
necessary, and this property is removed from the file.
-->
<PrivateSourceBuiltArtifactsPackageVersion>6.0.1-1</PrivateSourceBuiltArtifactsPackageVersion>
<PrivateSourceBuiltArtifactsPackageVersion>6.0.2</PrivateSourceBuiltArtifactsPackageVersion>
</PropertyGroup>
<!-- Workload manifest package versions -->
<PropertyGroup>

View file

@ -0,0 +1,19 @@
Param(
[Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed
)
Write-Host "Creating dir $ManifestDirPath"
# create directory for sbom manifest to be placed
if (!(Test-Path -path $ManifestDirPath))
{
New-Item -ItemType Directory -path $ManifestDirPath
Write-Host "Successfully created directory $ManifestDirPath"
}
else{
Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder."
}
Write-Host "Updating artifact name"
$artifact_name = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" -replace '["/:<>\\|?@*"() ]', '_'
Write-Host "Artifact name $artifact_name"
Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$artifact_name"

View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
source="${BASH_SOURCE[0]}"
manifest_dir=$1
if [ ! -d "$manifest_dir" ] ; then
mkdir -p "$manifest_dir"
echo "Sbom directory created." $manifest_dir
else
Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder."
fi
artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM"
echo "Artifact name before : "$artifact_name
# replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts.
safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}"
echo "Artifact name after : "$safe_artifact_name
export ARTIFACT_NAME=$safe_artifact_name
echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name"
exit 0

View file

@ -31,6 +31,10 @@ parameters:
name: ''
preSteps: []
runAsPublic: false
# Sbom related params
enableSbom: true
PackageVersion: 6.0.0
BuildDropPath: '$(Build.SourcesDirectory)/artifacts'
jobs:
- job: ${{ parameters.name }}
@ -247,3 +251,9 @@ jobs:
ArtifactName: AssetManifests
continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}:
- template: /eng/common/templates/steps/generate-sbom.yml
parameters:
PackageVersion: ${{ parameters.packageVersion}}
BuildDropPath: ${{ parameters.buildDropPath }}

View file

@ -8,10 +8,6 @@ parameters:
# Optional: Enable publishing using release pipelines
enablePublishUsingPipelines: false
# Optional: Disable component governance detection. In general, component governance
# should be on for all jobs. Use only in the event of issues.
disableComponentGovernance: false
# Optional: Enable running the source-build jobs to build repo from source
enableSourceBuild: false

View file

@ -0,0 +1,44 @@
# BuildDropPath - The root folder of the drop directory for which the manifest file will be generated.
# PackageName - The name of the package this SBOM represents.
# PackageVersion - The version of the package this SBOM represents.
# ManifestDirPath - The path of the directory where the generated manifest files will be placed
parameters:
PackageVersion: 6.0.0
BuildDropPath: '$(Build.SourcesDirectory)/artifacts'
PackageName: '.NET'
ManifestDirPath: $(Build.ArtifactStagingDirectory)/sbom
sbomContinueOnError: true
steps:
- task: PowerShell@2
displayName: Prep for SBOM generation in (Non-linux)
condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin'))
inputs:
filePath: ./eng/common/generate-sbom-prep.ps1
arguments: ${{parameters.manifestDirPath}}
# Chmodding is a workaround for https://github.com/dotnet/arcade/issues/8461
- script: |
chmod +x ./eng/common/generate-sbom-prep.sh
./eng/common/generate-sbom-prep.sh ${{parameters.manifestDirPath}}
displayName: Prep for SBOM generation in (Linux)
condition: eq(variables['Agent.Os'], 'Linux')
continueOnError: ${{ parameters.sbomContinueOnError }}
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'Generate SBOM manifest'
continueOnError: ${{ parameters.sbomContinueOnError }}
inputs:
PackageName: ${{ parameters.packageName }}
BuildDropPath: ${{ parameters.buildDropPath }}
PackageVersion: ${{ parameters.packageVersion }}
ManifestDirPath: ${{ parameters.manifestDirPath }}
- task: PublishPipelineArtifact@1
displayName: Publish SBOM manifest
continueOnError: ${{parameters.sbomContinueOnError}}
inputs:
targetPath: '${{parameters.manifestDirPath}}'
artifactName: $(ARTIFACT_NAME)

View file

@ -43,8 +43,8 @@ steps:
# In that case, add variables to allow the download of internal runtimes if the specified versions are not found
# in the default public locations.
internalRuntimeDownloadArgs=
if [ '$(dotnetbuilds-internal-container-read-token-base64)' != '$''(dotnetbuilds-internal-container-read-token-base64)' ]; then
internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64) --runtimesourcefeed https://dotnetbuilds.blob.core.windows.net/internal --runtimesourcefeedkey $(dotnetbuilds-internal-container-read-token-base64)'
if [ '$(dotnetclimsrc-read-sas-token-base64)' != '$''(dotnetclimsrc-read-sas-token-base64)' ]; then
internalRuntimeDownloadArgs='/p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64) --runtimesourcefeed https://dotnetclimsrc.blob.core.windows.net/dotnet --runtimesourcefeedkey $(dotnetclimsrc-read-sas-token-base64)'
fi
buildConfig=Release

View file

@ -11,4 +11,4 @@ stages:
jobs:
- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
parameters:
tarballResourceId: installer-build-resource
installerBuildResourceId: installer-build-resource

View file

@ -11,4 +11,4 @@ stages:
jobs:
- template: /src/SourceBuild/Arcade/eng/common/templates/job/source-build-run-tarball-build.yml
parameters:
tarballResourceId: installer-build-resource
installerBuildResourceId: installer-build-resource

View file

@ -11,7 +11,7 @@
"cmake": "3.16.4"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22107.2",
"Microsoft.DotNet.CMake.Sdk": "6.0.0-beta.22107.2"
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22122.7",
"Microsoft.DotNet.CMake.Sdk": "6.0.0-beta.22122.7"
}
}

View file

@ -80,9 +80,12 @@ jobs:
# This prevents allocation of additional agents if the tarball build legs should be skipped.
# Only build the tarball if the PR touches source-build source.
- script: |
if curl "https://api.github.com/repos/dotnet/installer/pulls/$(System.PullRequest.PullRequestNumber)/files" | grep '"filename": "src/SourceBuild/*'
then
echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]true"
fi
# Temporarily disable tarball PR validation until source-build is supported in this channel.
echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]false"
# if curl "https://api.github.com/repos/dotnet/installer/pulls/$(System.PullRequest.PullRequestNumber)/files" | grep '"filename": "src/SourceBuild/*'
# then
# echo "##vso[task.setvariable variable=_includeTarballBuild;isoutput=true]true"
# fi
displayName: Tarball Build Check
name: Tarball_Build_Check

View file

@ -7,13 +7,15 @@ parameters:
# Dependent jobs that must be completed before this job will run
dependsOn:
# The resource id of the tarball to download and build
tarballResourceId: current
# Resource id of the installer build to retrieve source/product tarball's from
installerBuildResourceId: current
# The following parameters aren't expected to be passed in rather they are used for encapsulation
# -----------------------------------------------------------------------------------------------
buildJobTimeout: 300
centOS7Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-source-build-20210714125450-5d87b80
centOS8Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-source-build-20211118190102-9355e7b
centOSStream9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9-20220107135047-4cd394c
debian9Container: mcr.microsoft.com/dotnet-buildtools/prereqs:debian-stretch-20211001171226-047508b
fedora33Container: mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-33-20210222183538-031e7d2
ubuntu1804Container: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-20210924170306-047508b
@ -38,37 +40,49 @@ jobs:
strategy:
matrix:
CentOS7-Online:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: true
CentOS7-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_Platform: linux
_RunOnline: false
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
CentOS7-Offline:
_BootstrapPrep: true
_BuildArch: x64
_Container: ${{ parameters.centOS7Container }}
_ExcludeOmniSharpTests: true
_RunOnline: false
CentOS8-Offline:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOS8Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
CentOSStream9-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.centOSStream9Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Fedora33-Offline:
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
Ubuntu1804-Offline:
_BootstrapPrep: true
_BootstrapPrep: false
_BuildArch: x64
_Container: ${{ parameters.ubuntu1804Container }}
_ExcludeOmniSharpTests: false
_Platform: linux
_RunOnline: false
timeoutInMinutes: 300
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
@ -79,20 +93,13 @@ jobs:
- checkout: self
clean: true
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- template: /src/SourceBuild/Arcade/eng/common/templates/steps/source-build-build-tarball.yml
parameters:
buildArch: $(_BuildArch)
container: $(_Container)
excludeOmniSharpTests: $(_ExcludeOmniSharpTests)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
platform: $(_Platform)
prepScript: |
set -x
@ -104,12 +111,14 @@ jobs:
docker run --rm -v ${{ parameters.tarballDir }}:/tarball -w /tarball $(_Container) ./prep.sh ${customPrepArgs}
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}
tarballResourceId: ${{ parameters.tarballResourceId }}
- ${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
- job: Rebuild_Tarball
displayName: Rebuild Tarball With Previous
dependsOn: Build_Tarball
# Always attempt to run the bootstrap leg (e.g. even when stage 1 tests fail) in order to get a complete accessment of the build status.
# The bootstrap build will shortcut if the stage 1 build failed.
condition: and(${{ parameters.condition }}, succeededOrFailed())
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
${{ parameters.poolPublic }}
@ -121,8 +130,9 @@ jobs:
_PreviousSourceBuildArtifact: Build Tarball Fedora33-Offline_Artifacts
_BuildArch: x64
_Container: ${{ parameters.fedora33Container }}
_Platform: linux
_RunOnline: false
timeoutInMinutes: 180
timeoutInMinutes: ${{ parameters.buildJobTimeout }}
variables:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: AzureDevOps-Artifact-Feeds-Pats
@ -133,15 +143,6 @@ jobs:
- checkout: self
clean: true
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- download: current
artifact: $(_PreviousSourceBuildArtifact)
patterns: '*.tar.gz'
@ -159,6 +160,9 @@ jobs:
additionalBuildArgs: --with-sdk /tarball/.dotnet
buildArch: $(_BuildArch)
container: $(_Container)
installerBuildResourceId: ${{ parameters.installerBuildResourceId }}
isBootstrapped: true
platform: $(_Platform)
prepScript: |
set -x
@ -168,4 +172,3 @@ jobs:
eval rm -f "$tarballFilePath"
runOnline: $(_RunOnline)
tarballDir: ${{ parameters.tarballDir }}
tarballResourceId: ${{ parameters.tarballResourceId }}

View file

@ -13,6 +13,15 @@ parameters:
# Skip running the OmniSharp smoke-tests
excludeOmniSharpTests: false
# Resource id of the installer build to retrieve source/product tarball's from
installerBuildResourceId: null
# Whether or not this is a bootstrapped build
isBootstrapped: false
# Platform the build is running on (linux, osx, win)
platform: null
# Script logic to prep the tarball for building
prepScript: null
@ -22,21 +31,32 @@ parameters:
# Directory to build the tarball in
tarballDir:
# Resource id of the tarball to download and build
tarballResourceId: null
steps:
- download: ${{ parameters.tarballResourceId }}
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- download: ${{ parameters.installerBuildResourceId }}
artifact: BlobArtifacts
patterns: '**/dotnet-sdk-source*.tar.gz'
displayName: Download Tarball
displayName: Download Source Tarball
- download: ${{ parameters.installerBuildResourceId }}
artifact: BlobArtifacts
patterns: '**/dotnet-sdk-!(*-*)-${{ parameters.platform }}-${{ parameters.buildArch }}.tar.gz'
displayName: Download MSFT sdk Tarball
- script: |
set -x
resourceIdPathSegment=
if [ '${{ parameters.tarballResourceId }}' != 'current' ]; then
resourceIdPathSegment='${{ parameters.tarballResourceId }}/'
if [ '${{ parameters.installerBuildResourceId }}' != 'current' ]; then
resourceIdPathSegment='${{ parameters.installerBuildResourceId }}/'
fi
mkdir -p "${{ parameters.tarballDir }}"
@ -67,10 +87,19 @@ steps:
set -x
# Use installer repo's NuGet.config during online testing to utilize internal feeds
rm -f ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/smoke-tests/online.NuGet.Config
cp NuGet.config ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/smoke-tests/online.NuGet.Config
rm -f ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/smoke-tests/online.NuGet.Config
cp $(Build.SourcesDirectory)/NuGet.config ${{ parameters.tarballDir }}/test/Microsoft.DotNet.SourceBuild.SmokeTests/assets/smoke-tests/online.NuGet.Config
docker run --rm -v ${{ parameters.tarballDir }}:/tarball -w /tarball -e EXCLUDE_OMNISHARP_TESTS=${{ parameters.excludeOmniSharpTests}} ${{ parameters.container }} ./build.sh --run-smoke-test ${{ parameters.additionalBuildArgs }}
dockerVolumeArgs="-v ${{ parameters.tarballDir }}:/tarball"
dockerEnvArgs="-e SMOKE_TESTS_EXCLUDE_OMNISHARP=${{ parameters.excludeOmniSharpTests}}"
if [[ '${{ parameters.isBootstrapped }}' != 'true' && '${{ parameters.installerBuildResourceId }}' != 'current' ]]; then
dockerVolumeArgs+=" -v $(PIPELINE.WORKSPACE)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/:/BlobArtifacts"
msftSdkTarballName=$(find "$(PIPELINE.WORKSPACE)/${{ parameters.installerBuildResourceId }}/BlobArtifacts/" -name "dotnet-sdk-*-${{ parameters.Platform }}-${{ parameters.buildArch }}.tar.gz" -exec basename {} \;)
dockerEnvArgs+=" -e SMOKE_TESTS_MSFT_SDK_TARBALL_PATH=/BlobArtifacts/$msftSdkTarballName"
fi
docker run --rm $dockerVolumeArgs -w /tarball $dockerEnvArgs ${{ parameters.container }} ./build.sh --run-smoke-test ${{ parameters.additionalBuildArgs }}
displayName: Run Tests
# Don't use CopyFiles@2 as it encounters permissions issues because it indexes all files in the source directory graph.
@ -86,7 +115,7 @@ steps:
find artifacts/prebuilt-report/ -exec cp {} --parents -t ${targetFolder} \;
find src/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
find src/ -type f -name "*.log" -exec cp {} --parents -t ${targetFolder} \;
find test/*/*/*/*/*/testing-smoke*/logs -exec cp {} --parents -t ${targetFolder} \;
find test/ -type f -name "*.binlog" -exec cp {} --parents -t ${targetFolder} \;
displayName: Prepare BuildLogs staging directory
continueOnError: true
condition: succeededOrFailed()

View file

@ -11,35 +11,10 @@
should be added to source-build-reference-packages.
-->
<ItemGroup>
<PackageDownload Include="Microsoft.DotNet.Common.ItemTemplates"
Version="[$(MicrosoftDotNetCommonItemTemplates30PackageVersion)];
[$(MicrosoftDotNetCommonItemTemplates31PackageVersion)];
[$(MicrosoftDotNetCommonItemTemplates50PackageVersion)];
[$(MicrosoftDotNetCommonItemTemplates60PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ItemTemplates"
Version="[$(AspNetCorePackageVersionFor21Templates)];
[$(AspNetCorePackageVersionFor30Templates)];
[$(AspNetCorePackageVersionFor31Templates)];
[$(AspNetCorePackageVersionFor50Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Common.ItemTemplates" Version="[$(MicrosoftDotNetCommonItemTemplates60PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ItemTemplates.6.0" Version="[$(AspNetCorePackageVersionFor60Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Common.ProjectTemplates.3.0" Version="[$(MicrosoftDotNetCommonProjectTemplates30PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Common.ProjectTemplates.3.1" Version="[$(MicrosoftDotNetCommonProjectTemplates31PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Common.ProjectTemplates.5.0" Version="[$(MicrosoftDotNetCommonProjectTemplates50PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Common.ProjectTemplates.6.0" Version="[$(MicrosoftDotNetCommonProjectTemplates60PackageVersion)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ProjectTemplates.2.1" Version="[$(AspNetCorePackageVersionFor21Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ProjectTemplates.3.0" Version="[$(AspNetCorePackageVersionFor30Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ProjectTemplates.3.1" Version="[$(AspNetCorePackageVersionFor31Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ProjectTemplates.5.0" Version="[$(AspNetCorePackageVersionFor50Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.ProjectTemplates.6.0" Version="[$(AspNetCorePackageVersionFor60Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.Spa.ProjectTemplates.2.1" Version="[$(AspNetCorePackageVersionFor21Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.Spa.ProjectTemplates.3.0" Version="[$(AspNetCorePackageVersionFor30Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.Spa.ProjectTemplates.3.1" Version="[$(AspNetCorePackageVersionFor31Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.Spa.ProjectTemplates.5.0" Version="[$(AspNetCorePackageVersionFor50Templates)]" />
<PackageDownload Include="Microsoft.DotNet.Web.Spa.ProjectTemplates.6.0" Version="[$(AspNetCorePackageVersionFor60Templates)]" />
<PackageDownload Include="Microsoft.NET.Sdk.Android.Manifest-6.0.200" Version="[$(XamarinAndroidWorkloadManifestVersion)]" />

View file

@ -148,18 +148,9 @@
<PoisonedReportFile>$(PackageReportDir)poisoned.txt</PoisonedReportFile>
<ConflictingPackageReportDir>$(BaseOutputPath)conflict-report/</ConflictingPackageReportDir>
<PrebuiltBurndownDataFile>$(PackageReportDir)PrebuiltBurndownData.csv</PrebuiltBurndownDataFile>
<ReferencePackagesBaseDir>$(IntermediatePath)reference-packages/</ReferencePackagesBaseDir>
<TextOnlyPackageBaseDir>$(IntermediatePath)text-only-packages/</TextOnlyPackageBaseDir>
<ExternalTarballsDir>$(IntermediatePath)external-tarballs/</ExternalTarballsDir>
<!--
Change ReferencePackagesBaseDir & ExternalTarballsDir conditionally in offline build.
See corresponding change in build-source-tarball.sh to copy reference-packages & external-tarballs
from source-build bin dir to tarball packages/reference dir & packages/archive.
-->
<ExternalTarballsDir>$(ProjectDir)packages/archive/</ExternalTarballsDir>
<ReferencePackagesBaseDir>$(ProjectDir)packages/reference/</ReferencePackagesBaseDir>
<TextOnlyPackageBaseDir>$(ProjectDir)packages/text-only/</TextOnlyPackageBaseDir>
<ReferencePackagesDir>$(ReferencePackagesBaseDir)packages/</ReferencePackagesDir>
<ReferencePackagesDir>$(ProjectDir)packages/reference/</ReferencePackagesDir>
<SourceBuiltArtifactsTarballName>Private.SourceBuilt.Artifacts</SourceBuiltArtifactsTarballName>
<SourceBuiltPrebuiltsTarballName>Private.SourceBuilt.Prebuilts</SourceBuiltPrebuiltsTarballName>
<SourceBuiltArtifactsTarballUrl>https://dotnetcli.azureedge.net/source-built-artifacts/assets/</SourceBuiltArtifactsTarballUrl>
@ -168,6 +159,7 @@
<BaselineDataFile>$(ToolsLocalDir)prebuilt-baseline.xml</BaselineDataFile>
<!--Exclude tests that are failing for test enabled projects like - corefx -->
<TestExclusionsDir>$(ProjectDir)test/exclusions/</TestExclusionsDir>
<SmokeTestsDir>$(ProjectDir)test/Microsoft.DotNet.SourceBuild.SmokeTests/</SmokeTestsDir>
</PropertyGroup>
<!-- Import Build tools common props file where repo-independent properties are found -->

View file

@ -21,10 +21,6 @@
<MSBuild Projects="repos\$(RootRepoTests).proj" Targets="Build" Properties="RunTests=true;SkipEnsurePackagesCreated=true" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="true" />
</Target>
<Target Name="CreateRootRepoFile" AfterTargets="PrepareOutput">
<WriteLinesToFile Lines="$(RootRepo)" File="$(BaseIntermediatePath)rootrepo.txt" Overwrite="True" />
</Target>
<Target Name="PrepareOutput">
<MakeDir Directories="$(OutputPath)" />
<MakeDir Directories="$(LoggingDir)" />
@ -99,24 +95,47 @@
<SdkTarballPath>%(SdkTarballItem.Identity)</SdkTarballPath>
</PropertyGroup>
<Exec Command="$(DotnetToolCommand) test ./test/Microsoft.DotNet.SourceBuild.SmokeTests --logger:trx -c $(Configuration)"
<Exec Command="$(DotnetToolCommand) test $(SmokeTestsDir) --logger:trx -c $(Configuration)"
EnvironmentVariables="
DOTNET_TARBALL_PATH=$(SdkTarballPath);
TARGET_RID=$(TargetRid);
SMOKE_TESTS_SDK_TARBALL_PATH=$(SdkTarballPath);
SMOKE_TESTS_TARGET_RID=$(TargetRid);
" />
</Target>
<Target Name="CreateSmokeTestPrereqs"
<Target Name="CreateSmokeTestPrereqsTarball"
AfterTargets="RunSmokeTest"
Condition="'$(SkipSmokeTestPrereqsTarballCreation)' != 'true'" >
Condition="'$(SkipSmokeTestPrereqsTarballCreation)' != 'true'"
DependsOnTargets="
CheckIfCreateSmokeTestPrereqsExistToPack;
CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"/>
<Target Name="CheckIfCreateSmokeTestPrereqsExistToPack">
<PropertyGroup>
<SmokeTestPrereqsTarballName>$(OutputPath)dotnet-smoke-test-prereqs.$(installerOutputPackageVersion).tar.gz</SmokeTestPrereqsTarballName>
<SmokeTestsArtifactsDir>$(SmokeTestsDir)bin/$(Configuration)/net6.0/</SmokeTestsArtifactsDir>
<SmokeTestsPackagesDir>$(SmokeTestsArtifactsDir)packages/</SmokeTestsPackagesDir>
</PropertyGroup>
<Exec Command="tar --numeric-owner -czf $(SmokeTestPrereqsTarballName) ."
WorkingDirectory="./test/Microsoft.DotNet.SourceBuild.SmokeTests/bin/$(Configuration)/net6.0/smoke-tests/prereq-packages/"/>
<ItemGroup>
<SmokeTestsPrereqs Include="$(SmokeTestsPackagesDir)**/*.nupkg" />
</ItemGroup>
<Message Importance="High" Text="Packaged smoke-test prereqs to $(SmokeTestPrereqsTarballName)" />
<Message Text="Found @(SmokeTestsPrereqs->Count()) prereqs in '$(SmokeTestsPackagesDir)'." Importance="High" />
</Target>
<Target Name="CreateCreateSmokeTestPrereqsTarballIfPrereqsExist"
Condition="'@(SmokeTestsPrereqs->Count())' != '0'">
<PropertyGroup>
<SmokeTestPrereqsTarballName>$(OutputPath)dotnet-smoke-test-prereqs.$(installerOutputPackageVersion).tar.gz</SmokeTestPrereqsTarballName>
<SmokeTestsPrereqPackagesDir>$(SmokeTestsArtifactsDir)prereq-packages/</SmokeTestsPrereqPackagesDir>
</PropertyGroup>
<Copy SourceFiles="@(SmokeTestsPrereqs)"
DestinationFolder="$(SmokeTestsPrereqPackagesDir)" />
<Exec Command="tar --numeric-owner -czf $(SmokeTestPrereqsTarballName) ."
WorkingDirectory="$(SmokeTestsPrereqPackagesDir)"/>
<Message Importance="High" Text="Packaged smoke-test prereqs in '$(SmokeTestPrereqsTarballName)'" />
</Target>
<UsingTask AssemblyFile="$(XPlatSourceBuildTasksAssembly)" TaskName="UploadToAzure" />

View file

@ -1,6 +1,6 @@
{
"tools": {
"dotnet": "6.0.200-preview.21603.2"
"dotnet": "6.0.200"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions": "2.0.1",

View file

@ -154,5 +154,6 @@
<ArcadeSharedFrameworkSdkOverride Include="Microsoft.DotNet.SharedFramework.Sdk" Group="ARCADE_SHARED_FX_SDK" Version="$(arcadeOutputPackageVersion)"/>
<ILSdkOverride Include="Microsoft.NET.Sdk.IL" Group="IL" />
<MsBuildTraversalSdkOverride Include="Microsoft.Build.Traversal" Group="MSBUILD_TRAVERSAL" Version="2.0.2"/>
<WindowsDesktopSdkOverride Include="Microsoft.Net.Sdk.WindowsDesktop" Group="WINDOWS_DESKTOP" Location="$(ToolsLocalDir)EmptySdk"/>
</ItemGroup>
</Project>

View file

@ -92,7 +92,9 @@
<!-- Don't warn on warnings that can be generated in source-build
but not necessarily in repo builds.
NU1603 - See https://github.com/dotnet/source-build/issues/2766.
NU5104 - During preview builds, some packages have pre-release versions.
Some repos with stable versions may need to uptake these packages
with pre-release versions because of PVP when building with
@ -101,7 +103,7 @@
<OldText><![CDATA[</Project>]]></OldText>
<NewText>
<![CDATA[ <PropertyGroup>
<NoWarn>%24(NoWarn);NU5104</NoWarn>
<NoWarn>%24(NoWarn);NU5104;NU1603</NoWarn>
</PropertyGroup>
</Project>]]>
</NewText>

View file

@ -45,6 +45,7 @@
<ItemGroup>
<UseSourceBuiltSdkOverride Include="@(ArcadeSdkOverride)" />
<UseSourceBuiltSdkOverride Include="@(WindowsDesktopSdkOverride)" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

View file

@ -4,15 +4,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
internal class BaselineHelper
{
public static void Compare(string baselineFileName, IOrderedEnumerable<string> actualEntries)
public static void CompareEntries(string baselineFileName, IOrderedEnumerable<string> actualEntries)
{
IEnumerable<string> baseline = File.ReadAllLines(GetBaselineFilePath(baselineFileName));
string[] missingEntries = actualEntries.Except(baseline).ToArray();
@ -32,6 +34,45 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests
Assert.Null(message);
}
private static string GetBaselineFilePath(string baselineFileName) => Path.Combine(Directory.GetCurrentDirectory(), "baselines", baselineFileName);
public static void CompareContents(string baselineFileName, string actualContents, ITestOutputHelper outputHelper)
{
string baselineFilePath = GetBaselineFilePath(baselineFileName);
string actualFilePath = Path.Combine(Environment.CurrentDirectory, $"{baselineFileName}");
File.WriteAllText(actualFilePath, actualContents);
CompareFiles(baselineFilePath, actualFilePath, outputHelper);
}
public static void CompareFiles(string baselineFilePath, string actualFilePath, ITestOutputHelper outputHelper)
{
string baselineFileText = File.ReadAllText(baselineFilePath);
string actualFileText = File.ReadAllText(actualFilePath);
string? message = null;
if (baselineFileText != actualFileText)
{
// Retrieve a diff in order to provide a UX which calls out the diffs.
string diff = DiffFiles(baselineFilePath, actualFilePath, outputHelper);
message = $"{Environment.NewLine}Baseline '{baselineFilePath}' does not match actual '{actualFilePath}`. {Environment.NewLine}"
+ $"{diff}{Environment.NewLine}";
}
Assert.Null(message);
}
public static string DiffFiles(string file1Path, string file2Path, ITestOutputHelper outputHelper)
{
(Process Process, string StdOut, string StdErr) diffResult =
ExecuteHelper.ExecuteProcess("git", $"diff --no-index {file1Path} {file2Path}", outputHelper);
Assert.Equal(1, diffResult.Process.ExitCode);
return diffResult.StdOut;
}
public static string GetAssetsDirectory() => Path.Combine(Directory.GetCurrentDirectory(), "assets");
private static string GetBaselineFilePath(string baselineFileName) => Path.Combine(GetAssetsDirectory(), "baselines", baselineFileName);
}
}

View file

@ -0,0 +1,39 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
/// <summary>
/// Basic project create, build, run, publish scenario tests.
/// <see cref="WebScenarioTests"/> for related web scenarios.
/// They are encapsulated in a separate testclass so that they can be run in parallel.
/// </summary>
public class BasicScenarioTests : SmokeTests
{
public BasicScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
[Theory]
[MemberData(nameof(GetScenarioObjects))]
public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper);
private static IEnumerable<object[]> GetScenarioObjects() => GetScenarios().Select(scenario => new object[] { scenario });
private static IEnumerable<TestScenario> GetScenarios()
{
foreach (DotNetLanguage language in Enum.GetValues<DotNetLanguage>())
{
yield return new(nameof(BasicScenarioTests), language, DotNetTemplate.Console, DotNetActions.Build | DotNetActions.Run | DotNetActions.PublishComplex | DotNetActions.PublishR2R);
yield return new(nameof(BasicScenarioTests), language, DotNetTemplate.ClassLib, DotNetActions.Build | DotNetActions.Publish);
yield return new(nameof(BasicScenarioTests), language, DotNetTemplate.XUnit, DotNetActions.Test);
yield return new(nameof(BasicScenarioTests), language, DotNetTemplate.NUnit, DotNetActions.Test);
yield return new(nameof(BasicScenarioTests), language, DotNetTemplate.MSTest, DotNetActions.Test);
}
}
}

View file

@ -3,17 +3,24 @@
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal static class Config
{
public static string DotNetDirectory { get; } = Environment.GetEnvironmentVariable("DOTNET_DIR") ?? "./.dotnet";
public static string DotNetTarballPath { get; } = Environment.GetEnvironmentVariable(DotNetTarballPathEnv) ?? string.Empty;
public const string DotNetTarballPathEnv = "DOTNET_TARBALL_PATH";
public static bool ExcludeOmniSharpTests { get; } =
bool.TryParse(Environment.GetEnvironmentVariable("EXCLUDE_OMNISHARP_TESTS"), out bool excludeOmniSharpTests) ? excludeOmniSharpTests : false;
public static bool ExcludeOnlineTests { get; } =
bool.TryParse(Environment.GetEnvironmentVariable("EXCLUDE_ONLINE_TESTS"), out bool excludeOnlineTests) ? excludeOnlineTests : false;
public static string TargetRid { get; } = Environment.GetEnvironmentVariable("TARGET_RID") ?? string.Empty;
public const string DotNetDirectoryEnv = "SMOKE_TESTS_DOTNET_DIR";
public const string ExcludeOmniSharpEnv = "SMOKE_TESTS_EXCLUDE_OMNISHARP";
public const string MsftSdkTarballPathEnv = "SMOKE_TESTS_MSFT_SDK_TARBALL_PATH";
public const string PrereqsPathEnv = "SMOKE_TESTS_PREREQS_PATH";
public const string SdkTarballPathEnv = "SMOKE_TESTS_SDK_TARBALL_PATH";
public const string TargetRidEnv = "SMOKE_TESTS_TARGET_RID";
public static string DotNetDirectory { get; } =
Environment.GetEnvironmentVariable(DotNetDirectoryEnv) ?? Path.Combine(Directory.GetCurrentDirectory(), ".dotnet");
public static string? MsftSdkTarballPath { get; } = Environment.GetEnvironmentVariable(MsftSdkTarballPathEnv);
public static string? PrereqsPath { get; } = Environment.GetEnvironmentVariable(PrereqsPathEnv);
public static string? SdkTarballPath { get; } = Environment.GetEnvironmentVariable(SdkTarballPathEnv);
public static string TargetRid { get; } = Environment.GetEnvironmentVariable(TargetRidEnv) ??
throw new InvalidOperationException($"'{Config.TargetRidEnv}' must be specified");
}

View file

@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
[Flags]
public enum DotNetActions
{
None = 0,
Build = 1,
Run = 2,
RunWeb = 4,
Publish = 8,
PublishComplex = 16,
PublishR2R = 32,
Test = 64,
}

View file

@ -0,0 +1,40 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public class DotNetFormatTests : SmokeTests
{
private const string UnformattedFileName = "FormatTestUnformatted.cs";
private const string ExpectedFormattedFileName = "FormatTestExpectedFormatted.cs";
public DotNetFormatTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
/// <Summary>
/// Format an unformatted project and verify that the output matches the pre-computed solution.
/// </Summary>
[Fact]
public void FormatProject()
{
string assetsDirectory = BaselineHelper.GetAssetsDirectory();
string unformattedCsFilePath = Path.Combine(assetsDirectory, UnformattedFileName);
string expectedFormattedCsFilePath = Path.Combine(assetsDirectory, ExpectedFormattedFileName);
string projectDirectory = DotNetHelper.ExecuteNew("console", nameof(FormatProject), "C#");
string projectFilePath = Path.Combine(projectDirectory, nameof(FormatProject) + ".csproj");
string formattedCsFilePath = Path.Combine(projectDirectory, UnformattedFileName);
File.Copy(unformattedCsFilePath, formattedCsFilePath);
DotNetHelper.ExecuteCmd($"format {projectFilePath}");
BaselineHelper.CompareFiles(expectedFormattedCsFilePath, formattedCsFilePath, OutputHelper);
}
}

View file

@ -12,30 +12,199 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal class DotNetHelper
{
public string DotNetPath { get; }
public string DotNetInstallDirectory { get; }
private static readonly object s_lockObj = new();
public static string DotNetPath { get; } = Path.Combine(Config.DotNetDirectory, "dotnet");
public static string LogsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "logs");
public static string PackagesDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "packages");
public static string ProjectsDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), $"projects-{DateTime.Now:yyyyMMddHHmmssffff}");
private ITestOutputHelper OutputHelper { get; }
public DotNetHelper(ITestOutputHelper outputHelper)
{
if (!Directory.Exists(Config.DotNetDirectory))
OutputHelper = outputHelper;
lock (s_lockObj)
{
if (!File.Exists(Config.DotNetTarballPath))
if (!Directory.Exists(Config.DotNetDirectory))
{
throw new InvalidOperationException($"Tarball path '{Config.DotNetTarballPath}' specified in {Config.DotNetTarballPathEnv} does not exist.");
if (!File.Exists(Config.SdkTarballPath))
{
throw new InvalidOperationException($"Tarball path '{Config.SdkTarballPath}' specified in {Config.SdkTarballPath} does not exist.");
}
Directory.CreateDirectory(Config.DotNetDirectory);
ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"xzf {Config.SdkTarballPath} -C {Config.DotNetDirectory}", outputHelper);
}
Directory.CreateDirectory(Config.DotNetDirectory);
ExecuteHelper.ExecuteProcess("tar", $"xzf {Config.DotNetTarballPath} -C {Config.DotNetDirectory}", outputHelper);
if (!Directory.Exists(ProjectsDirectory))
{
Directory.CreateDirectory(ProjectsDirectory);
InitNugetConfig();
}
if (!Directory.Exists(PackagesDirectory))
{
Directory.CreateDirectory(PackagesDirectory);
}
if (!Directory.Exists(LogsDirectory))
{
Directory.CreateDirectory(LogsDirectory);
}
}
}
private static void InitNugetConfig()
{
bool useLocalPackages = !string.IsNullOrEmpty(Config.PrereqsPath);
string nugetConfigPrefix = useLocalPackages ? "local" : "online";
string nugetConfigPath = Path.Combine(ProjectsDirectory, "NuGet.Config");
File.Copy(
Path.Combine(BaselineHelper.GetAssetsDirectory(), $"{nugetConfigPrefix}.NuGet.Config"),
nugetConfigPath);
if (useLocalPackages)
{
if (!Directory.Exists(Config.PrereqsPath))
{
throw new InvalidOperationException(
$"Prereqs path '{Config.PrereqsPath}' specified in {Config.PrereqsPathEnv} does not exist.");
}
string nugetConfig = File.ReadAllText(nugetConfigPath);
nugetConfig = nugetConfig.Replace("SMOKE_TEST_PACKAGE_FEED", Config.PrereqsPath);
File.WriteAllText(nugetConfigPath, nugetConfig);
}
}
public void ExecuteCmd(string args, string? workingDirectory = null)
{
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
DotNetPath,
args,
OutputHelper,
configure: (process) => ConfigureProcess(process, workingDirectory));
ExecuteHelper.ValidateExitCode(executeResult);
}
public static void ConfigureProcess(Process process, string? workingDirectory, bool setPath = false)
{
if (workingDirectory != null)
{
process.StartInfo.WorkingDirectory = workingDirectory;
}
DotNetInstallDirectory = Path.Combine(Directory.GetCurrentDirectory(), Config.DotNetDirectory);
DotNetPath = Path.Combine(DotNetInstallDirectory, "dotnet");
process.StartInfo.EnvironmentVariables["DOTNET_CLI_TELEMETRY_OPTOUT"] = "1";
process.StartInfo.EnvironmentVariables["DOTNET_SKIP_FIRST_TIME_EXPERIENCE"] = "1";
process.StartInfo.EnvironmentVariables["DOTNET_ROOT"] = Config.DotNetDirectory;
process.StartInfo.EnvironmentVariables["NUGET_PACKAGES"] = PackagesDirectory;
if (setPath)
{
process.StartInfo.EnvironmentVariables["PATH"] = $"{Config.DotNetDirectory}:{Environment.GetEnvironmentVariable("PATH")}";
}
}
public void ExecuteDotNetCmd(string args, ITestOutputHelper outputHelper)
public void ExecuteBuild(string projectName) =>
ExecuteCmd($"build {GetBinLogOption(projectName, "build")}", GetProjectDirectory(projectName));
/// <summary>
/// Create a new .NET project and return the path to the created project folder.
/// </summary>
public string ExecuteNew(string projectType, string name, string? language = null, string? customArgs = null)
{
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(DotNetPath, args, outputHelper);
string projectDirectory = GetProjectDirectory(name);
string options = $"--name {name} --output {projectDirectory}";
if (language != null)
{
options += $" --language \"{language}\"";
}
if (string.IsNullOrEmpty(customArgs))
{
options += $" {customArgs}";
}
Assert.Equal(0, executeResult.Process.ExitCode);
ExecuteCmd($"new {projectType} {options}");
return projectDirectory;
}
public void ExecutePublish(string projectName, bool? selfContained = null, string? rid = null, bool trimmed = false, bool readyToRun = false)
{
string options = string.Empty;
string binlogDifferentiator = string.Empty;
if (selfContained.HasValue)
{
options += $"--self-contained {selfContained.Value.ToString().ToLowerInvariant()}";
if (selfContained.Value)
{
binlogDifferentiator += "self-contained";
if (!string.IsNullOrEmpty(rid))
{
options += $" -r {rid}";
binlogDifferentiator += $"-{rid}";
}
if (trimmed)
{
options += " /p:PublishTrimmed=true";
binlogDifferentiator += "-trimmed";
}
if (readyToRun)
{
options += " /p:PublishReadyToRun=true";
binlogDifferentiator += "-R2R";
}
}
}
ExecuteCmd(
$"publish {options} {GetBinLogOption(projectName, "publish", binlogDifferentiator)}",
GetProjectDirectory(projectName));
}
public void ExecuteRun(string projectName) =>
ExecuteCmd($"run {GetBinLogOption(projectName, "run")}", GetProjectDirectory(projectName));
public void ExecuteRunWeb(string projectName)
{
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
DotNetPath,
$"run {GetBinLogOption(projectName, "run")}",
OutputHelper,
configure: configureProcess,
millisecondTimeout: 30000);
ExecuteHelper.ValidateExitCode(executeResult);
void configureProcess(Process process)
{
ConfigureProcess(process, GetProjectDirectory(projectName));
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
{
if (e.Data?.Contains("Application started. Press Ctrl+C to shut down.") ?? false)
{
ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper);
}
});
}
}
public void ExecuteTest(string projectName) =>
ExecuteCmd($"test {GetBinLogOption(projectName, "test")}", GetProjectDirectory(projectName));
private static string GetBinLogOption(string projectName, string command, string? differentiator = null)
{
string fileName = $"{projectName}-{command}";
if (!string.IsNullOrEmpty(differentiator))
{
fileName += $"-{differentiator}";
}
return $"/bl:{Path.Combine(LogsDirectory, $"{fileName}.binlog")}";
}
private static string GetProjectDirectory(string projectName) => Path.Combine(ProjectsDirectory, projectName);
}

View file

@ -0,0 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public enum DotNetLanguage
{
CSharp,
FSharp,
VB
}

View file

@ -0,0 +1,18 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public static class DotNetLanguageExtensions
{
public static string ToCliName(this DotNetLanguage language) => language switch
{
DotNetLanguage.CSharp => "C#",
DotNetLanguage.FSharp => "F#",
DotNetLanguage.VB => "VB",
_ => throw new NotImplementedException()
};
}

View file

@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public enum DotNetTemplate
{
Console,
ClassLib,
XUnit,
NUnit,
MSTest,
Web,
Mvc,
Razor,
BlazorWasm,
BlazorServer,
WebApi,
WebApp,
Worker,
Angular,
}

View file

@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public static class DotNetTemplateExtensions
{
public static string GetName(this DotNetTemplate template) => Enum.GetName(template)?.ToLowerInvariant() ?? throw new NotSupportedException();
public static bool IsAspNetCore(this DotNetTemplate template) =>
template == DotNetTemplate.Web
|| template == DotNetTemplate.Mvc
|| template == DotNetTemplate.WebApi
|| template == DotNetTemplate.Razor
|| template == DotNetTemplate.BlazorWasm
|| template == DotNetTemplate.BlazorServer
|| template == DotNetTemplate.Worker
|| template == DotNetTemplate.Angular;
}

View file

@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.Linq;
using System.Text;
@ -12,7 +13,12 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal static class ExecuteHelper
{
public static (Process Process, string StdOut, string StdErr) ExecuteProcess(
string fileName, string args, ITestOutputHelper outputHelper)
string fileName,
string args,
ITestOutputHelper outputHelper,
bool logOutput = false,
Action<Process>? configure = null,
int millisecondTimeout = -1)
{
outputHelper.WriteLine($"Executing: {fileName} {args}");
@ -35,6 +41,8 @@ internal static class ExecuteHelper
process.StartInfo.Environment.Remove(key);
}
configure?.Invoke(process);
StringBuilder stdOutput = new();
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) => stdOutput.AppendLine(e.Data));
@ -44,20 +52,48 @@ internal static class ExecuteHelper
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
process.WaitForExit(millisecondTimeout);
if (!process.HasExited)
{
outputHelper.WriteLine($"Killing: {fileName} {args}");
process.Kill(true);
process.WaitForExit();
}
string output = stdOutput.ToString().Trim();
if (outputHelper != null && !string.IsNullOrWhiteSpace(output))
if (logOutput && !string.IsNullOrWhiteSpace(output))
{
outputHelper.WriteLine(output);
}
string error = stdError.ToString().Trim();
if (outputHelper != null && !string.IsNullOrWhiteSpace(error))
if (logOutput && !string.IsNullOrWhiteSpace(error))
{
outputHelper.WriteLine(error);
}
return (process, output, error);
}
public static string ExecuteProcessValidateExitCode(string fileName, string args, ITestOutputHelper outputHelper)
{
(Process Process, string StdOut, string StdErr) result = ExecuteHelper.ExecuteProcess(fileName, args, outputHelper);
ValidateExitCode(result);
return result.StdOut;
}
public static void ValidateExitCode((Process Process, string StdOut, string StdErr) result)
{
if (result.Process.ExitCode != 0)
{
ProcessStartInfo startInfo = result.Process.StartInfo;
string msg = $"Failed to execute {startInfo.FileName} {startInfo.Arguments}" +
$"{Environment.NewLine}Exit code: {result.Process.ExitCode}" +
$"{Environment.NewLine}{result.StdOut}" +
$"{Environment.NewLine}{result.StdErr}";
throw new InvalidOperationException(msg);
}
}
}

View file

@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
internal static class HttpClientExtensions
{
public static async Task DownloadFileAsync(this HttpClient client, Uri uri, string path)
{
using Stream stream = await client.GetStreamAsync(uri);
using FileStream fileStream = new(path, FileMode.OpenOrCreate);
await stream.CopyToAsync(fileStream);
}
}

View file

@ -18,19 +18,22 @@
</ItemGroup>
<ItemGroup>
<Content Include="baselines/*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="smoke-tests/*">
<Content Include="assets/**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Remove="assets/**" />
<EmbeddedResource Remove="assets/**" />
<None Remove="assets/**" />
</ItemGroup>
<ItemGroup>
<SmokeTestPrereqs Include="..\..\packages\smoke-test-prereqs\*" />
</ItemGroup>
<Target Name="CopySmokeTestPrereqs" BeforeTargets="Build">
<Copy SourceFiles="@(SmokeTestPrereqs)" DestinationFolder="$(OutputPath)\smoke-tests\prereq-packages" />
<Copy SourceFiles="@(SmokeTestPrereqs)" DestinationFolder="$(OutputPath)\assets\smoke-tests\prereq-packages" />
</Target>
</Project>

View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.SourceBuild.SmokeTests", "Microsoft.DotNet.SourceBuild.SmokeTests.csproj", "{FEB5A0B5-460B-432A-BED8-243557188AFF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FEB5A0B5-460B-432A-BED8-243557188AFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEB5A0B5-460B-432A-BED8-243557188AFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEB5A0B5-460B-432A-BED8-243557188AFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEB5A0B5-460B-432A-BED8-243557188AFF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75929D76-EEB5-4793-8335-DF623CC72B56}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,71 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
/// <summary>
/// OmniSharp tests to ensure it works with a source-built sdk.
/// </summary>
public class OmniSharpTests : SmokeTests
{
private string OmniSharpDirectory { get; } = Path.Combine(Directory.GetCurrentDirectory(), "omnisharp");
public OmniSharpTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
[SkippableTheory(Config.ExcludeOmniSharpEnv, skipOnTrue: true)]
[InlineData(DotNetTemplate.BlazorWasm)]
[InlineData(DotNetTemplate.BlazorServer)]
[InlineData(DotNetTemplate.ClassLib)]
[InlineData(DotNetTemplate.Console)]
[InlineData(DotNetTemplate.MSTest)]
[InlineData(DotNetTemplate.Mvc)]
[InlineData(DotNetTemplate.NUnit)]
[InlineData(DotNetTemplate.Web)]
[InlineData(DotNetTemplate.WebApp)]
[InlineData(DotNetTemplate.WebApi)]
[InlineData(DotNetTemplate.Worker)]
[InlineData(DotNetTemplate.XUnit)]
public async void VerifyScenario(DotNetTemplate template)
{
await InitializeOmniSharp();
string templateName = template.GetName();
string projectName = $"{nameof(OmniSharpTests)}_{templateName}";
string projectDirectory = DotNetHelper.ExecuteNew(templateName, projectName);
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
Path.Combine(OmniSharpDirectory, "run"),
$"-s {projectDirectory}",
OutputHelper,
logOutput: true,
millisecondTimeout: 5000,
configure: (process) => DotNetHelper.ConfigureProcess(process, projectDirectory, setPath: true));
Assert.NotEqual(0, executeResult.Process.ExitCode);
Assert.DoesNotContain("ERROR", executeResult.StdOut);
Assert.DoesNotContain("ERROR", executeResult.StdErr);
}
private async Task InitializeOmniSharp()
{
if (!Directory.Exists(OmniSharpDirectory))
{
using HttpClient client = new();
string omniSharpTarballFile = "omnisharp-linux-x64.tar.gz";
Uri omniSharpTarballUrl = new($"https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/{omniSharpTarballFile}");
await client.DownloadFileAsync(omniSharpTarballUrl, omniSharpTarballFile);
Directory.CreateDirectory(OmniSharpDirectory);
ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"xzf {omniSharpTarballFile} -C {OmniSharpDirectory}", OutputHelper);
}
}
}

View file

@ -4,6 +4,7 @@
* Various configuration settings are stored in `Config.cs`
## Prereq Packages
Some prerelease scenarios, usually security updates, require non-source-built packages which are not publicly available.
Place these packages in the tarball's `packages/smoke-test-prereqs`. When prereq packages are required, the
`EXCLUDE_ONLINE_TESTS=true` environment variable should be set when running tests via `build.sh --run-smoke-test`.
Specify the directory where these packages can be found via the `SMOKE_TESTS_PREREQS_PATH` environment variable when running tests via `build.sh --run-smoke-test` e.g.
`SMOKE_TESTS_PREREQS_PATH=packages/smoke-test-prereqs`.

View file

@ -0,0 +1,78 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public class SdkContentTests : SmokeTests
{
public SdkContentTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
/// <Summary>
/// Verifies the file layout of the source built sdk tarball to the Microsoft build.
/// The differences are captured in baselines/MsftToSbSdkDiff.txt.
/// Version numbers that appear in paths are compared but are stripped from the baseline.
/// This makes the baseline durable between releases. This does mean however, entries
/// in the baseline may appear identical if the diff is version specific.
/// </Summary>
[SkippableFact(new[] { Config.MsftSdkTarballPathEnv, Config.MsftSdkTarballPathEnv }, skipOnNullOrWhiteSpace: true)]
public void CompareMsftToSb()
{
const string msftFileListingFileName = "msftSdkFiles.txt";
const string sbFileListingFileName = "sbSdkFiles.txt";
WriteTarballFileList(Config.MsftSdkTarballPath, msftFileListingFileName);
WriteTarballFileList(Config.SdkTarballPath, sbFileListingFileName);
string diff = BaselineHelper.DiffFiles(msftFileListingFileName, sbFileListingFileName, OutputHelper);
diff = RemoveVersionedPaths(diff);
diff = RemoveDiffMarkers(diff);
diff = RemoveRids(diff);
BaselineHelper.CompareContents("MsftToSbSdk.diff", diff, OutputHelper);
}
private void WriteTarballFileList(string? tarballPath, string outputFileName)
{
if (!File.Exists(tarballPath))
{
throw new InvalidOperationException($"Tarball path '{tarballPath}' does not exist.");
}
string fileListing = ExecuteHelper.ExecuteProcessValidateExitCode("tar", $"tf {tarballPath}", OutputHelper);
IEnumerable<string> files = fileListing.Split(Environment.NewLine).OrderBy(path => path);
File.WriteAllLines(outputFileName, files);
}
private static string RemoveDiffMarkers(string source)
{
Regex indexRegex = new("^index .*", RegexOptions.Multiline);
string result = indexRegex.Replace(source, "index ------------");
Regex diffSegmentRegex = new("^@@ .* @@", RegexOptions.Multiline);
return diffSegmentRegex.Replace(result, "@@ ------------ @@");
}
private static string RemoveRids(string diff) => diff.Replace(Config.TargetRid, "banana.rid");
private static string RemoveVersionedPaths(string source)
{
// Remove semantic version path segments
string pathSeparator = Regex.Escape(Path.DirectorySeparatorChar.ToString());
// Regex source: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
Regex semanticVersionRegex = new(
$"{pathSeparator}(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)"
+ $"(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))"
+ $"?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?{pathSeparator}");
string result = semanticVersionRegex.Replace(source, $"{Path.DirectorySeparatorChar}x.y.z{Path.DirectorySeparatorChar}");
// Remove net.x.y path segments
Regex netTfmRegex = new($"{pathSeparator}net[1-9]*.[0-9]{pathSeparator}");
return netTfmRegex.Replace(result, $"{Path.DirectorySeparatorChar}netx.y{Path.DirectorySeparatorChar}");
}
}

View file

@ -0,0 +1,40 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Xunit;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
/// <summary>
/// A Fact that will be skipped based on the specified environment variable's value.
/// </summary>
internal class SkippableFactAttribute : FactAttribute
{
public SkippableFactAttribute(string envName, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envName);
public SkippableFactAttribute(string[] envNames, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envNames);
public static void CheckEnvs(bool skipOnNullOrWhiteSpace, bool skipOnTrue, Action<string> setSkip, params string[] envNames)
{
foreach (string envName in envNames)
{
string? envValue = Environment.GetEnvironmentVariable(envName);
if (skipOnNullOrWhiteSpace && string.IsNullOrWhiteSpace(envValue))
{
setSkip($"Skipping because `{envName}` is null or whitespace");
break;
}
else if (skipOnTrue && bool.TryParse(envValue, out bool boolValue) && boolValue)
{
setSkip($"Skipping because `{envName}` is set to True");
break;
}
}
}
}
}

View file

@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Xunit;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
/// <summary>
/// A Theory that will be skipped based on the specified environment variable's value.
/// </summary>
internal class SkippableTheoryAttribute : TheoryAttribute
{
public SkippableTheoryAttribute(string envName, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
SkippableFactAttribute.CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envName);
public SkippableTheoryAttribute(string[] envNames, bool skipOnNullOrWhiteSpace = false, bool skipOnTrue = false) =>
SkippableFactAttribute.CheckEnvs(skipOnNullOrWhiteSpace, skipOnTrue, (skip) => Skip = skip, envNames);
}
}

View file

@ -1,45 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.IO;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
// This test suite invokes the smoke-test.sh which should be considered legacy. Those tests should be migrated to this test suite overtime.
public class SmokeTests
/// <summary>
/// Shared base class for all smoke tests.
/// </summary>
public abstract class SmokeTests
{
private ITestOutputHelper OutputHelper { get; }
private DotNetHelper DotNetHelper { get; }
internal DotNetHelper DotNetHelper { get; }
internal ITestOutputHelper OutputHelper { get; }
public SmokeTests(ITestOutputHelper outputHelper)
protected SmokeTests(ITestOutputHelper outputHelper)
{
OutputHelper = outputHelper;
DotNetHelper = new DotNetHelper(outputHelper);
}
[Fact]
public void SmokeTestsScript()
{
string smokeTestArgs = $"--dotnetDir {Directory.GetParent(DotNetHelper.DotNetPath)} --projectOutput --archiveRestoredPackages --targetRid {Config.TargetRid}";
if (Config.TargetRid.Contains("osx"))
{
smokeTestArgs += " --excludeWebHttpsTests";
}
if (Config.ExcludeOmniSharpTests)
{
smokeTestArgs += " --excludeOmniSharpTests";
}
if (Config.ExcludeOnlineTests)
{
smokeTestArgs += " --excludeOnlineTests";
}
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess("./smoke-tests/smoke-test.sh", smokeTestArgs, OutputHelper);
Assert.Equal(0, executeResult.Process.ExitCode);
OutputHelper = outputHelper;
}
}

View file

@ -0,0 +1,67 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace Microsoft.DotNet.SourceBuild.SmokeTests
{
public class TestScenario
{
public DotNetActions Commands { get; }
public DotNetLanguage Language { get; }
public bool NoHttps { get; set; } = Config.TargetRid.Contains("osx");
public string ScenarioName { get; }
public DotNetTemplate Template { get; }
public TestScenario(string scenarioName, DotNetLanguage language, DotNetTemplate template, DotNetActions commands = DotNetActions.None)
{
ScenarioName = scenarioName;
Template = template;
Language = language;
Commands = commands;
}
internal void Execute(DotNetHelper dotNetHelper)
{
// Don't use the cli language name in the project name because it may contain '#': https://github.com/dotnet/roslyn/issues/51692
string projectName = $"{ScenarioName}_{Template}_{Language}";
string customNewArgs = Template.IsAspNetCore() && NoHttps ? "--no-https" : string.Empty;
dotNetHelper.ExecuteNew(Template.GetName(), projectName, Language.ToCliName(), customArgs: customNewArgs);
if (Commands.HasFlag(DotNetActions.Build))
{
dotNetHelper.ExecuteBuild(projectName);
}
if (Commands.HasFlag(DotNetActions.Run))
{
if (Template.IsAspNetCore())
{
dotNetHelper.ExecuteRunWeb(projectName);
}
else
{
dotNetHelper.ExecuteRun(projectName);
}
}
if (Commands.HasFlag(DotNetActions.Publish))
{
dotNetHelper.ExecutePublish(projectName);
}
if (Commands.HasFlag(DotNetActions.PublishComplex))
{
dotNetHelper.ExecutePublish(projectName, selfContained: false);
dotNetHelper.ExecutePublish(projectName, selfContained: true, Config.TargetRid);
dotNetHelper.ExecutePublish(projectName, selfContained: true, "linux-x64");
}
if (Commands.HasFlag(DotNetActions.PublishR2R))
{
dotNetHelper.ExecutePublish(projectName, selfContained: true, "linux-x64", trimmed: true, readyToRun: true);
}
if (Commands.HasFlag(DotNetActions.Test))
{
dotNetHelper.ExecuteTest(projectName);
}
}
}
}

View file

@ -0,0 +1,42 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
/// <summary>
/// Web project create, build, run, publish scenario tests.
/// <see cref="BaseScenarioTests"/> for related basic scenarios.
/// They are encapsulated in a separate testclass so that they can be run in parallel.
/// </summary>
public class WebScenarioTests : SmokeTests
{
public WebScenarioTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
[Theory]
[MemberData(nameof(GetScenarioObjects))]
public void VerifyScenario(TestScenario scenario) => scenario.Execute(DotNetHelper);
private static IEnumerable<object[]> GetScenarioObjects() => GetScenarios().Select(scenario => new object[] { scenario });
private static IEnumerable<TestScenario> GetScenarios()
{
foreach (DotNetLanguage language in new[] { DotNetLanguage.CSharp, DotNetLanguage.FSharp })
{
yield return new(nameof(WebScenarioTests), language, DotNetTemplate.Web, DotNetActions.Build | DotNetActions.Run | DotNetActions.PublishComplex);
yield return new(nameof(WebScenarioTests), language, DotNetTemplate.Mvc, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish) { NoHttps = true };
yield return new(nameof(WebScenarioTests), language, DotNetTemplate.WebApi, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish);
}
yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.Razor, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish);
yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.BlazorWasm, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish);
yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.BlazorServer, DotNetActions.Build | DotNetActions.Run | DotNetActions.Publish);
yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.Worker);
yield return new(nameof(WebScenarioTests), DotNetLanguage.CSharp, DotNetTemplate.Angular);
}
}

View file

@ -4,23 +4,15 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
using System;
using System.Linq;
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
public class XmlDocTests
public class XmlDocTests : SmokeTests
{
private ITestOutputHelper OutputHelper { get; }
private DotNetHelper DotNetHelper { get; }
public XmlDocTests(ITestOutputHelper outputHelper)
{
OutputHelper = outputHelper;
DotNetHelper = new DotNetHelper(outputHelper);
}
public XmlDocTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
/// <Summary>
/// Verifies every targeting pack assembly has a xml doc file.
@ -31,7 +23,7 @@ public class XmlDocTests
{
List<string> missingXmlDoc = new();
string targetingPacksDirectory = Path.Combine(DotNetHelper.DotNetInstallDirectory, "packs");
string targetingPacksDirectory = Path.Combine(Config.DotNetDirectory, "packs");
foreach (string targetingPackAssembly in Directory.EnumerateFiles(targetingPacksDirectory, "*.dll", SearchOption.AllDirectories))
{
if (targetingPackAssembly.EndsWith("resources.dll"))
@ -42,13 +34,13 @@ public class XmlDocTests
string xmlFile = Path.ChangeExtension(targetingPackAssembly, ".xml");
if (!File.Exists(xmlFile))
{
string pathWithoutPacksPrefix = xmlFile.Substring(targetingPacksDirectory.Length + 1);
String[] pathParts = pathWithoutPacksPrefix.Split(Path.DirectorySeparatorChar);
string pathWithoutPacksPrefix = xmlFile[(targetingPacksDirectory.Length + 1)..];
string[] pathParts = pathWithoutPacksPrefix.Split(Path.DirectorySeparatorChar);
string pathWithoutVersion = string.Join(Path.DirectorySeparatorChar, pathParts.Take(1).Concat(pathParts.Skip(2)));
missingXmlDoc.Add(pathWithoutVersion);
}
}
BaselineHelper.Compare("MissingXmlDoc.txt", missingXmlDoc.OrderBy(entry => entry));
BaselineHelper.CompareEntries("MissingXmlDoc.txt", missingXmlDoc.OrderBy(entry => entry));
}
}

View file

@ -0,0 +1,11 @@
namespace FormatTest
{
internal class Test
{
public void Run()
{
string test = "Hello World";
Console.WriteLine(test);
}
}
}

View file

@ -0,0 +1,11 @@
namespace FormatTest
{
internal class Test
{
public void Run()
{
string test = "Hello World" ;
Console .WriteLine( test );
}
}
}

View file

@ -2,7 +2,6 @@
<configuration>
<packageSources>
<clear />
<add key="source-built-packages" value="SOURCE_BUILT_PACKAGES" />
<add key="smoke-test-prereqs" value="SMOKE_TEST_PACKAGE_FEED" />
</packageSources>
</configuration>

View file

@ -1,530 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_ROOT="$(cd -P "$( dirname "$0" )" && pwd)"
TARBALL_PREFIX=dotnet-sdk-
VERSION_PREFIX=6.0
# See https://github.com/dotnet/source-build/issues/579, this version
# needs to be compatible with the runtime produced from source-build
DEV_CERTS_VERSION_DEFAULT=6.0.0-rtm.21573.1
__ROOT_REPO=$(sed 's/\r$//' "$SCRIPT_ROOT/artifacts/obj/rootrepo.txt") # remove CR if mounted repo on Windows drive
executingUserHome=${HOME:-}
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Use uname to determine what the CPU is.
cpuName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [[ "$cpuName" == "unknown" ]]; then
cpuName=$(uname -m)
fi
case $cpuName in
aarch64)
buildArch=arm64
;;
amd64|x86_64)
buildArch=x64
;;
armv*l)
buildArch=arm
;;
i686)
buildArch=x86
;;
s390x)
buildArch=s390x
;;
*)
echo "Unknown CPU $cpuName detected, treating it as x64"
buildArch=x64
;;
esac
projectOutput=false
keepProjects=false
dotnetDir=""
configuration="Release"
excludeNonWebTests=false
excludeWebTests=false
excludeWebNoHttpsTests=false
excludeWebHttpsTests=false
excludeLocalTests=false
excludeOnlineTests=false
excludeOmniSharpTests=${excludeOmniSharpTests:-false}
devCertsVersion="$DEV_CERTS_VERSION_DEFAULT"
testingDir="$SCRIPT_ROOT/testing-smoke-$(date +"%m%d%H%M%S")"
cliDir="$testingDir/builtCli"
logsDir="$testingDir/logs"
logFile="$logsDir/smoke-test.log"
omnisharpLogFile="$logsDir/omnisharp.log"
restoredPackagesDir="$testingDir/packages"
testingHome="$testingDir/home"
archiveRestoredPackages=false
smokeTestPrebuilts="$SCRIPT_ROOT/prereq-packages"
nonSbSmokeTestPrebuilts="$SCRIPT_ROOT/non-source-built-prereq-packages"
runningOnline=false
runningHttps=false
function usage() {
echo ""
echo "usage:"
echo " --dotnetDir the directory from which to run dotnet"
echo " --configuration the configuration being tested (default=Release)"
echo " --targetRid override the target rid to use when needed (e.g. for self-contained publish tests)"
echo " --projectOutput echo dotnet's output to console"
echo " --keepProjects keep projects after tests are complete"
echo " --minimal run minimal set of tests - local sources only, no web"
echo " --excludeNonWebTests don't run tests for non-web projects"
echo " --excludeWebTests don't run tests for web projects"
echo " --excludeWebNoHttpsTests don't run web project tests with --no-https"
echo " --excludeWebHttpsTests don't run web project tests with https using dotnet-dev-certs"
echo " --excludeLocalTests exclude tests that use local sources for nuget packages"
echo " --excludeOnlineTests exclude test that use online sources for nuget packages"
echo " --excludeOmniSharpTests don't run the OmniSharp tests"
echo " --devCertsVersion <version> use dotnet-dev-certs <version> instead of default $DEV_CERTS_VERSION_DEFAULT"
echo " --archiveRestoredPackages capture all restored packages to $smokeTestPrebuilts"
echo ""
}
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case $lowerI in
'-?'|-h|--help)
usage
exit 0
;;
--dotnetdir)
shift
dotnetDir="$1"
;;
--configuration)
shift
configuration="$1"
;;
--targetrid)
shift
targetRid="$1"
;;
--projectoutput)
projectOutput=true
;;
--keepprojects)
keepProjects=true
;;
--minimal)
excludeOnlineTests=true
;;
--excludenonwebtests)
excludeNonWebTests=true
;;
--excludewebtests)
excludeWebTests=true
;;
--excludewebnohttpstests)
excludeWebNoHttpsTests=true
;;
--excludewebhttpstests)
excludeWebHttpsTests=true
;;
--excludelocaltests)
excludeLocalTests=true
;;
--excludeonlinetests)
excludeOnlineTests=true
;;
--excludeomnisharptests)
excludeOmniSharpTests=true
;;
--devcertsversion)
shift
devCertsVersion="$1"
;;
--archiverestoredpackages)
archiveRestoredPackages=true
;;
*)
echo "Unrecognized argument '$1'"
usage
exit 1
;;
esac
shift
done
function doCommand() {
lang=$1
proj=$2
shift; shift;
echo "starting language $lang, type $proj" | tee -a smoke-test.log
dotnetCmd=${dotnetDir}/dotnet
# rename '#'' to 'Sharp' to workaround https://github.com/dotnet/roslyn/issues/51692
projectDir="${lang//#/Sharp}_${proj}"
mkdir "${projectDir}"
cd "${projectDir}"
newArgs="new $proj -lang $lang"
while :; do
if [ $# -le 0 ]; then
break
fi
case "$1" in
--new-arg)
shift
newArgs="$newArgs $1"
;;
*)
break
;;
esac
shift
done
while :; do
if [ $# -le 0 ]; then
break
fi
binlogOnlinePart="local"
binlogHttpsPart="nohttps"
if [ "$runningOnline" == "true" ]; then
binlogOnlinePart="online"
fi
if [ "$runningHttps" == "true" ]; then
binlogHttpsPart="https"
fi
binlogPrefix="$logsDir/${projectDir}_${binlogOnlinePart}_${binlogHttpsPart}_"
binlog="${binlogPrefix}$1.binlog"
echo " running $1" | tee -a "$logFile"
if [ "$1" == "new" ]; then
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $newArgs --no-restore | tee -a "$logFile"
else
"${dotnetCmd}" $newArgs --no-restore >> "$logFile" 2>&1
fi
elif [[ "$1" == "run" && "$proj" =~ ^(web|mvc|webapi|razor|blazorwasm|blazorserver)$ ]]; then
# A separate log file that we will over-write all the time.
exitLogFile="$testingDir/exitLogFile"
echo > "$exitLogFile"
# Run an application in the background and redirect its
# stdout+stderr to a separate process (tee). The tee process
# writes its input to 2 files:
# - Either the normal log or stdout
# - A log that's only used to find out when it's safe to kill
# the application.
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $1 2>&1 > >(tee -a "$exitLogFile") &
else
"${dotnetCmd}" $1 2>&1 > >(tee -a "$logFile" "$exitLogFile" >/dev/null) &
fi
webPid=$!
killCommand="pkill -SIGTERM -P $webPid"
echo " waiting up to 30 seconds for web project with pid $webPid..."
echo " to clean up manually after an interactive cancellation, run: $killCommand"
for seconds in $(seq 30); do
if grep 'Application started. Press Ctrl+C to shut down.' "$exitLogFile"; then
echo " app ready for shutdown after $seconds seconds"
break
fi
sleep 1
done
echo " stopping $webPid" | tee -a "$logFile"
$killCommand
wait $!
echo " terminated with exit code $?" | tee -a "$logFile"
elif [ "$1" == "multi-rid-publish" ]; then
if [ "$lang" == "F#" ]; then
runPublishScenarios() {
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
"${dotnetCmd}" publish --self-contained true -r "$targetRid" /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
}
else
runPublishScenarios() {
"${dotnetCmd}" publish --self-contained false /bl:"${binlogPrefix}publish-fx-dep.binlog"
"${dotnetCmd}" publish --self-contained true -r "$targetRid" /bl:"${binlogPrefix}publish-self-contained-${targetRid}.binlog"
"${dotnetCmd}" publish --self-contained true -r linux-x64 /bl:"${binlogPrefix}publish-self-contained-portable.binlog"
}
fi
if [ "$projectOutput" == "true" ]; then
runPublishScenarios | tee -a "$logFile"
else
runPublishScenarios >> "$logFile" 2>&1
fi
else
if [ "$lang" == "F#" ]; then
# F# tries to use a truncated version number unless we pass it this flag. see https://github.com/dotnet/source-build/issues/2554
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $1 /bl:"$binlog" | tee -a "$logFile"
else
"${dotnetCmd}" $1 /bl:"$binlog" >> "$logFile" 2>&1
fi
else
if [ "$projectOutput" == "true" ]; then
"${dotnetCmd}" $1 /bl:"$binlog" | tee -a "$logFile"
else
"${dotnetCmd}" $1 /bl:"$binlog" >> "$logFile" 2>&1
fi
fi
fi
if [ $? -eq 0 ]; then
echo " $1 succeeded" >> "$logFile"
else
echo " $1 failed with exit code $?" | tee -a "$logFile"
fi
shift
done
cd ..
if [ "$keepProjects" == "false" ]; then
rm -rf "${projectDir}"
fi
echo "finished language $lang, type $proj" | tee -a smoke-test.log
}
function setupDevCerts() {
echo "Setting up dotnet-dev-certs $devCertsVersion to generate dev certificate" | tee -a "$logFile"
(
set -x
"$dotnetDir/dotnet" tool install -g dotnet-dev-certs --version "$devCertsVersion" --add-source https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
export DOTNET_ROOT="$dotnetDir"
"$testingHome/.dotnet/tools/dotnet-dev-certs" https
) >> "$logFile" 2>&1
}
function runAllTests() {
# Run tests for each language and template
if [ "$excludeNonWebTests" == "false" ]; then
doCommand C# console new restore build run multi-rid-publish
doCommand C# classlib new restore build multi-rid-publish
doCommand C# xunit new restore test
doCommand C# nunit new restore test
doCommand C# mstest new restore test
doCommand VB console new restore build run multi-rid-publish
doCommand VB classlib new restore build multi-rid-publish
doCommand VB xunit new restore test
doCommand VB nunit new restore test
doCommand VB mstest new restore test
doCommand F# console new restore build run multi-rid-publish
doCommand F# classlib new restore build multi-rid-publish
doCommand F# xunit new restore test
doCommand F# nunit new restore test
doCommand F# mstest new restore test
fi
if [ "$excludeWebTests" == "false" ]; then
if [ "$excludeWebNoHttpsTests" == "false" ]; then
runningHttps=false
runWebTests --new-arg --no-https
fi
if [ "$excludeWebHttpsTests" == "false" ]; then
runningHttps=true
setupDevCerts
runWebTests
fi
fi
}
function runWebTests() {
doCommand C# web "$@" new restore build run multi-rid-publish
doCommand C# mvc "$@" new restore build run multi-rid-publish
doCommand C# webapi "$@" new restore build multi-rid-publish
doCommand C# razor "$@" new restore build run multi-rid-publish
doCommand C# blazorwasm "$@" new restore build run publish
doCommand C# blazorserver "$@" new restore build run publish
doCommand F# web "$@" new restore build run multi-rid-publish
doCommand F# mvc "$@" new restore build run multi-rid-publish
doCommand F# webapi "$@" new restore build run multi-rid-publish
}
function runOmniSharpTests() {
dotnetCmd=${dotnetDir}/dotnet
rm -rf workdir
mkdir workdir
pushd workdir
curl -sSLO "https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-linux-x64.tar.gz"
mkdir omnisharp
pushd omnisharp
tar xf "../omnisharp-linux-x64.tar.gz"
popd
for project in blazorwasm blazorserver classlib console mstest mvc nunit web webapp webapi worker xunit ; do
mkdir hello-$project
pushd hello-$project
"${dotnetCmd}" new $project
popd
./omnisharp/run -s "$(readlink -f hello-$project)" > "$omnisharpLogFile" &
sleep 5
pkill -P $$
# Omnisharp spawns off a number of processes. They all include the
# current directory as a process argument, so use that to identify and
# kill them.
pgrep -f "$(pwd)"
kill "$(pgrep -f "$(pwd)")"
cat "$omnisharpLogFile"
if grep ERROR "$omnisharpLogFile"; then
echo "test failed"
exit 1
else
echo "OK"
fi
done
popd
}
function resetCaches() {
rm -rf "$testingHome"
mkdir "$testingHome"
HOME="$testingHome"
# clean restore path
rm -rf "$restoredPackagesDir"
# Copy NuGet plugins if running user has HOME and we have auth. In particular, the auth plugin.
if [ "${internalPackageFeedPat:-}" ] && [ "${executingUserHome:-}" ]; then
cp -r "$executingUserHome/.nuget/" "$HOME/.nuget/" || :
fi
}
function setupSmokeTestFeed() {
# Setup smoke-test-packages if they exist
if [ -e "$nonSbSmokeTestPrebuilts" ]; then
sed -i.bakSmokeTestFeed "s|SMOKE_TEST_PACKAGE_FEED|$nonSbSmokeTestPrebuilts|g" "$testingDir/NuGet.Config"
else
sed -i.bakSmokeTestFeed "/SMOKE_TEST_PACKAGE_FEED/d" "$testingDir/NuGet.Config"
fi
}
function copyRestoredPackages() {
if [ "$archiveRestoredPackages" == "true" ]; then
rm -rf "$smokeTestPrebuilts"
rm -rf "$nonSbSmokeTestPrebuilts"
mkdir -p "$smokeTestPrebuilts"
mkdir -p "$nonSbSmokeTestPrebuilts"
find "$restoredPackagesDir" -iname "*.nupkg" -exec mv {} "$smokeTestPrebuilts" \;
smokeTestPackages=$(find "$smokeTestPrebuilts" -iname "*.nupkg" -type f -printf "%f\n" | tr '[A-Z]' '[a-z]' | sort)
sourceBuiltPackages=$(find "$SOURCE_BUILT_PKGS_PATH" -iname "*.nupkg" -type f -printf "%f\n" | tr '[A-Z]' '[a-z]' | sort)
echo "Removing smoke-test prereq packages that are source built:"
comm -23 <(printf "$smokeTestPackages") <(printf "$sourceBuiltPackages") | while read line
do
echo "$line"
cp "$smokeTestPrebuilts/$line" "$nonSbSmokeTestPrebuilts"
done
fi
}
echo "RID to test: ${targetRid?not specified. Use ./build.sh --run-smoke-test to detect RID, or specify manually.}"
if [ "$__ROOT_REPO" != "known-good" ]; then
echo "Skipping smoke-tests since cli was not built";
exit
fi
# Clean up and create directory
if [ -e "$testingDir" ]; then
rm -rf "$testingDir"
fi
mkdir -p "$testingDir"
mkdir -p "$logsDir"
cd "$testingDir"
# Create blank Directory.Build files to avoid traversing to source-build infra.
echo "<Project />" | tee Directory.Build.props > Directory.Build.targets
# Unzip dotnet if the dotnetDir is not specified
if [ "$dotnetDir" == "" ]; then
OUTPUT_DIR="$ARTIFACTS_DIR$buildArch/$configuration/"
DOTNET_TARBALL="$(ls "${OUTPUT_DIR}${TARBALL_PREFIX}${VERSION_PREFIX}"*)"
mkdir -p "$cliDir"
tar xzf "$DOTNET_TARBALL" -C "$cliDir"
dotnetDir="$cliDir"
else
if ! [[ "$dotnetDir" = /* ]]; then
dotnetDir="$SCRIPT_ROOT/$dotnetDir"
fi
fi
echo SDK under test is:
"$dotnetDir/dotnet" --info
# setup restore path
export NUGET_PACKAGES="$restoredPackagesDir"
SOURCE_BUILT_PKGS_PATH="${ARTIFACTS_DIR}obj/$buildArch/$configuration/blob-feed/packages/"
export DOTNET_ROOT="$dotnetDir"
export PATH="$dotnetDir:$PATH"
# Run all tests, online restore sources first, local restore sources second
if [ "$excludeOnlineTests" == "false" ]; then
resetCaches
runningOnline=true
# Setup NuGet.Config to use online restore sources
if [ -e "$SCRIPT_ROOT/online.NuGet.Config" ]; then
cp "$SCRIPT_ROOT/online.NuGet.Config" "$testingDir/NuGet.Config"
echo "$testingDir/NuGet.Config Contents:"
cat "$testingDir/NuGet.Config"
fi
echo "RUN ALL TESTS - ONLINE RESTORE SOURCE"
runAllTests
copyRestoredPackages
echo "ONLINE RESTORE SOURCE - ALL TESTS PASSED!"
fi
if [ "$excludeLocalTests" == "false" ]; then
resetCaches
runningOnline=false
# Setup NuGet.Config with local restore source
if [ -e "$SCRIPT_ROOT/local.NuGet.Config" ]; then
cp "$SCRIPT_ROOT/local.NuGet.Config" "$testingDir/NuGet.Config"
sed -i.bak "s|SOURCE_BUILT_PACKAGES|$SOURCE_BUILT_PKGS_PATH|g" "$testingDir/NuGet.Config"
setupSmokeTestFeed
echo "$testingDir/NuGet.Config Contents:"
cat "$testingDir/NuGet.Config"
fi
echo "RUN ALL TESTS - LOCAL RESTORE SOURCE"
runAllTests
echo "LOCAL RESTORE SOURCE - ALL TESTS PASSED!"
fi
if [ "$excludeOmniSharpTests" == "false" ]; then
runOmniSharpTests
fi
echo "ALL TESTS PASSED!"

View file

@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<RepoRoot Condition="'$(RepoRoot)' == ''">$([MSBuild]::NormalizeDirectory('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'global.json'))'))</RepoRoot>
<RepositoryEngineeringDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'eng'))</RepositoryEngineeringDir>
</PropertyGroup>
<PropertyGroup>
<!-- Skip importing NuGet Pack targets which are imported from the Microsoft.NET.Sdk targets -->
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,9 @@
<Project>
<Target Name="_IsProjectRestoreSupported"/>
<Target Name="Restore"/>
<Target Name="Build"/>
<Target Name="Test"/>
<Target Name="Pack"/>
<Target Name="Publish"/>
</Project>

View file

@ -57,13 +57,13 @@
WorkingDirectory="$(PrebuiltPackagesPath)"
Condition="'@(SourceBuiltPrebuiltsTarballFile)' != ''" />
<!-- Move SBRP packages to reference packages location -->
<!-- Copy SBRP packages to reference packages location -->
<MakeDir Directories="$(ReferencePackagesDir)" />
<ItemGroup>
<UnpackedSourceBuildReferencePackages Include="$(PrebuiltSourceBuiltPackagesPath)SourceBuildReferencePackages/*"/>
</ItemGroup>
<Move SourceFiles="@(UnpackedSourceBuildReferencePackages)" DestinationFiles="$(ReferencePackagesDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(UnpackedSourceBuildReferencePackages)" DestinationFiles="$(ReferencePackagesDir)%(Filename)%(Extension)" />
<!-- remove some reference packages that are generated incorrectly and instead use the prebuilt checked-in version instead -->
<!-- relevant issues: https://github.com/dotnet/runtime/issues/44646, https://github.com/dotnet/runtime/issues/45183,

View file

@ -1,24 +0,0 @@
From 3610fdc1ac6437973d539177c1427ed7f4f65c2e Mon Sep 17 00:00:00 2001
From: Michael Simons <msimons@microsoft.com>
Date: Fri, 27 Aug 2021 13:34:55 +0000
Subject: [PATCH] Build Microsoft.DotNet.Build.Tasks.Workloads for net6.0
---
.../src/Microsoft.DotNet.Build.Tasks.Workloads.csproj | 1 +
1 files changed, 1 insertions(+)
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
index ae34705a..bda5d581 100644
--- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
+++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
@@ -2,6 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
+ <TargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>Latest</LangVersion>
<IsPackable>true</IsPackable>
--
2.29.2

View file

@ -1,26 +0,0 @@
From 676bb5aa455dcf877c78792e4e5a62ca6a1d72c1 Mon Sep 17 00:00:00 2001
From: Michael Simons <msimons@microsoft.com>
Date: Wed, 8 Sep 2021 16:43:11 +0000
Subject: [PATCH] Patch sdk.props to target net6.0
Workaround for https://github.com/dotnet/arcade/issues/7413
---
src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props
index e3c50582..a577f923 100644
--- a/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props
+++ b/src/Microsoft.DotNet.SharedFramework.Sdk/sdk/Sdk.props
@@ -8,7 +8,7 @@
-->
<PropertyGroup Condition="'$(DotNetSharedFrameworkTaskDir)' == ''">
- <DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core'">$(MSBuildThisFileDirectory)../tools/netcoreapp3.1/</DotNetSharedFrameworkTaskDir>
+ <DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' == 'core'">$(MSBuildThisFileDirectory)../tools/net6.0/</DotNetSharedFrameworkTaskDir>
<DotNetSharedFrameworkTaskDir Condition="'$(MSBuildRuntimeType)' != 'core'">$(MSBuildThisFileDirectory)../tools/net472/</DotNetSharedFrameworkTaskDir>
</PropertyGroup>
--
2.29.2

View file

@ -1,124 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Davis Goodin <dagood@microsoft.com>
Date: Fri, 8 Oct 2021 16:15:42 -0700
Subject: [PATCH] Disable Workloads WiX dependency in source-build
This removes the prebuilt WiX dependency: https://github.com/dotnet/arcade/issues/8014
The patch is temporary, pending upstream fix and dependency flow.
---
.../src/{FileRow.cs => FileRow.wix.cs} | 0
...ifestMsi.cs => GenerateManifestMsi.wix.cs} | 0
.../{GenerateMsi.cs => GenerateMsi.wix.cs} | 0
...erateMsiBase.cs => GenerateMsiBase.wix.cs} | 0
...erateVisualStudioMsiPackageProject.wix.cs} | 0
...cs => GenerateVisualStudioWorkload.wix.cs} | 0
...oadMsis.cs => GenerateWorkloadMsis.wix.cs} | 0
...rosoft.DotNet.Build.Tasks.Workloads.csproj | 23 ++++++++++++++++---
...{MsiProperties.cs => MsiProperties.wix.cs} | 0
.../src/{MsiUtils.cs => MsiUtils.wix.cs} | 0
...elatedProduct.cs => RelatedProduct.wix.cs} | 0
11 files changed, 20 insertions(+), 3 deletions(-)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{FileRow.cs => FileRow.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateManifestMsi.cs => GenerateManifestMsi.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateMsi.cs => GenerateMsi.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateMsiBase.cs => GenerateMsiBase.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateVisualStudioMsiPackageProject.cs => GenerateVisualStudioMsiPackageProject.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateVisualStudioWorkload.cs => GenerateVisualStudioWorkload.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{GenerateWorkloadMsis.cs => GenerateWorkloadMsis.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{MsiProperties.cs => MsiProperties.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{MsiUtils.cs => MsiUtils.wix.cs} (100%)
rename src/Microsoft.DotNet.Build.Tasks.Workloads/src/{RelatedProduct.cs => RelatedProduct.wix.cs} (100%)
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/FileRow.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateManifestMsi.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsi.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateMsiBase.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioMsiPackageProject.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateVisualStudioWorkload.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/GenerateWorkloadMsis.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
index 19cf67b5..2d02b7f4 100644
--- a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
+++ b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/Microsoft.DotNet.Build.Tasks.Workloads.csproj
@@ -11,6 +11,16 @@
<NoWarn>$(NoWarn);NU5127</NoWarn>
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
<RootNamespace>Microsoft.DotNet.Build.Tasks.Workloads</RootNamespace>
+
+ <!--
+ Only include WiX-powered features when running a non-from-source build. (For example, the
+ Microsoft build used to build .NET for Windows.)
+
+ This removes a dependency on prebuilt WiX binaries. The purpose of WiX is to produce Windows
+ installers, and source-build doesn't run on Windows, so excluding WiX while building in
+ source-build mode to remove the prebuilt dependency has no impact to available .NET features.
+ -->
+ <IncludeWiX Condition="'$(DotNetBuildFromSource)' != 'true'">true</IncludeWiX>
</PropertyGroup>
<ItemGroup>
@@ -19,13 +29,16 @@
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCoreVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkVersion)" />
<PackageReference Include="NuGet.Packaging" Version="$(NuGetVersion)" />
- <PackageReference Include="Wix" Version="3.11.2" />
<PackageReference Include="Microsoft.NET.Sdk.WorkloadManifestReader" Version="$(MicrosoftNetSdkWorkloadManifestReaderVersion)" />
- <PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" Condition="'$(TargetFramework)' == 'net472'"/>
+ <PackageReference Include="System.Text.Json" Version="$(SystemTextJsonVersion)" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="Microsoft.Deployment.DotNet.Releases" Version="$(MicrosoftDeploymentDotNetReleasesVersion)" />
</ItemGroup>
- <ItemGroup>
+ <ItemGroup Condition="'$(IncludeWiX)' == 'true'">
+ <PackageReference Include="Wix" Version="3.11.2" />
+ </ItemGroup>
+
+ <ItemGroup Condition="'$(IncludeWiX)' == 'true'">
<Reference Include="$(WixInstallPath)\Microsoft.Deployment.Resources.dll" />
<Reference Include="$(WixInstallPath)\Microsoft.Deployment.Compression.dll" />
<Reference Include="$(WixInstallPath)\Microsoft.Deployment.Compression.Cab.dll" />
@@ -48,6 +61,10 @@
<EmbeddedResource Remove="obj\**" />
</ItemGroup>
+ <ItemGroup Condition="'$(IncludeWiX)' != 'true'">
+ <Compile Remove="**\*.wix.cs" />
+ </ItemGroup>
+
<ItemGroup>
<EmbeddedResource Include="Misc\*.*" />
<EmbeddedResource Include="MsiTemplate\*.wxs" />
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiProperties.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/MsiUtils.wix.cs
diff --git a/src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.cs b/src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.wix.cs
similarity index 100%
rename from src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.cs
rename to src/Microsoft.DotNet.Build.Tasks.Workloads/src/RelatedProduct.wix.cs

View file

@ -1,146 +0,0 @@
From 110fc28ea7c17d57bbd5ce8ed3fc4e2b0274c5b3 Mon Sep 17 00:00:00 2001
From: dseefeld <dseefeld@microsoft.com>
Date: Fri, 22 Oct 2021 22:17:37 +0000
Subject: [PATCH] Build a subset of roslyn projects
Some projects use Microsoft.NET.Sdk.WindowsDesktop sdk
which cannot be built using a boostrapped source-build
sdk, since WindowsDesktop is not supported. These cannot
be ignored using ExcludeFromSourceBuild because the project
still needs to be loaded and the sdk cannot be found.
See https://github.com/dotnet/roslyn/issues/57342
---
Roslyn.SourceBuild.slnf | 105 ++++++++++++++++++++++++++++++++++++++++
eng/SourceBuild.props | 2 +-
2 files changed, 106 insertions(+), 1 deletion(-)
create mode 100644 Roslyn.SourceBuild.slnf
diff --git a/Roslyn.SourceBuild.slnf b/Roslyn.SourceBuild.slnf
new file mode 100644
index 00000000000..e6f8eb315bf
--- /dev/null
+++ b/Roslyn.SourceBuild.slnf
@@ -0,0 +1,105 @@
+{
+ "solution": {
+ "path": "Roslyn.sln",
+ "projects": [
+ "src\\Deployment\\RoslynDeployment.csproj",
+ "src\\Compilers\\Core\\Portable\\Microsoft.CodeAnalysis.csproj",
+ "src\\Compilers\\Server\\VBCSCompiler\\VBCSCompiler.csproj",
+ "src\\Compilers\\CSharp\\csc\\csc.csproj",
+ "src\\Compilers\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.csproj",
+ "src\\Compilers\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.vbproj",
+ "src\\Workspaces\\Core\\Portable\\Microsoft.CodeAnalysis.Workspaces.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\BoundTreeGenerator\\CompilersBoundTreeGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\CSharpErrorFactsGenerator\\CSharpErrorFactsGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\CSharpSyntaxGenerator\\CSharpSyntaxGenerator.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\VisualBasicSyntaxGenerator\\VisualBasicSyntaxGenerator.vbproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\VisualBasicErrorFactsGenerator\\VisualBasicErrorFactsGenerator.vbproj",
+ "src\\Workspaces\\Core\\Desktop\\Microsoft.CodeAnalysis.Workspaces.Desktop.csproj",
+ "src\\Workspaces\\Core\\MSBuild\\Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj",
+ "src\\Workspaces\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj",
+ "src\\Workspaces\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj",
+ "src\\Features\\VisualBasic\\Portable\\Microsoft.CodeAnalysis.VisualBasic.Features.vbproj",
+ "src\\Features\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.Features.csproj",
+ "src\\Features\\Core\\Portable\\Microsoft.CodeAnalysis.Features.csproj",
+ "src\\Scripting\\VisualBasic\\Microsoft.CodeAnalysis.VisualBasic.Scripting.vbproj",
+ "src\\Scripting\\Core\\Microsoft.CodeAnalysis.Scripting.csproj",
+ "src\\Scripting\\CSharp\\Microsoft.CodeAnalysis.CSharp.Scripting.csproj",
+ "src\\ExpressionEvaluator\\Package\\ExpressionEvaluatorPackage.csproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.CSharp.ExpressionCompiler.csproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler.vbproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ExpressionCompiler\\Microsoft.CodeAnalysis.ExpressionCompiler.csproj",
+ "src\\Compilers\\Core\\AnalyzerDriver\\AnalyzerDriver.shproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\BasicResultProvider.shproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\NetFX20\\BasicResultProvider.NetFX20.vbproj",
+ "src\\ExpressionEvaluator\\VisualBasic\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.VisualBasic.ResultProvider.vbproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\CSharpResultProvider.shproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\NetFX20\\CSharpResultProvider.NetFX20.csproj",
+ "src\\ExpressionEvaluator\\CSharp\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.CSharp.ResultProvider.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\ResultProvider.shproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\NetFX20\\ResultProvider.NetFX20.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\ResultProvider\\Portable\\Microsoft.CodeAnalysis.ResultProvider.csproj",
+ "src\\Compilers\\VisualBasic\\vbc\\vbc.csproj",
+ "src\\Compilers\\VisualBasic\\BasicAnalyzerDriver\\BasicAnalyzerDriver.shproj",
+ "src\\Compilers\\CSharp\\CSharpAnalyzerDriver\\CSharpAnalyzerDriver.shproj",
+ "src\\Compilers\\Core\\CommandLine\\CommandLine.shproj",
+ "src\\Compilers\\Extension\\Roslyn.Compilers.Extension.csproj",
+ "src\\Dependencies\\CodeAnalysis.Debugging\\Microsoft.CodeAnalysis.Debugging.shproj",
+ "src\\Dependencies\\PooledObjects\\Microsoft.CodeAnalysis.PooledObjects.shproj",
+ "src\\Workspaces\\Remote\\Core\\Microsoft.CodeAnalysis.Remote.Workspaces.csproj",
+ "src\\Workspaces\\Remote\\ServiceHub\\Microsoft.CodeAnalysis.Remote.ServiceHub.csproj",
+ "src\\Compilers\\Core\\MSBuildTask\\Microsoft.Build.Tasks.CodeAnalysis.csproj",
+ "src\\Tools\\BuildBoss\\BuildBoss.csproj",
+ "src\\ExpressionEvaluator\\Core\\Source\\FunctionResolver\\Microsoft.CodeAnalysis.FunctionResolver.csproj",
+ "src\\CodeStyle\\Core\\Analyzers\\Microsoft.CodeAnalysis.CodeStyle.csproj",
+ "src\\CodeStyle\\Core\\CodeFixes\\Microsoft.CodeAnalysis.CodeStyle.Fixes.csproj",
+ "src\\CodeStyle\\CSharp\\Analyzers\\Microsoft.CodeAnalysis.CSharp.CodeStyle.csproj",
+ "src\\CodeStyle\\CSharp\\CodeFixes\\Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes.csproj",
+ "src\\CodeStyle\\VisualBasic\\Analyzers\\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.vbproj",
+ "src\\CodeStyle\\VisualBasic\\CodeFixes\\Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes.vbproj",
+ "src\\Tools\\AnalyzerRunner\\AnalyzerRunner.csproj",
+ "src\\Dependencies\\CodeAnalysis.Debugging\\Microsoft.CodeAnalysis.Debugging.Package.csproj",
+ "src\\Dependencies\\PooledObjects\\Microsoft.CodeAnalysis.PooledObjects.Package.csproj",
+ "src\\NuGet\\Microsoft.Net.Compilers\\Microsoft.Net.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.NETCore.Compilers\\Microsoft.NETCore.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Compilers.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Scripting.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.EditorFeatures.Package.csproj",
+ "src\\NuGet\\Microsoft.CodeAnalysis.Package.csproj",
+ "src\\Setup\\DevDivVsix\\CompilersPackage\\Microsoft.CodeAnalysis.Compilers.Setup.csproj",
+ "src\\Setup\\Installer\\Installer.Package.csproj",
+ "src\\Setup\\DevDivInsertionFiles\\DevDivInsertionFiles.csproj",
+ "src\\Tools\\ExternalAccess\\FSharp\\Microsoft.CodeAnalysis.ExternalAccess.FSharp.csproj",
+ "src\\Tools\\ExternalAccess\\Razor\\Microsoft.CodeAnalysis.ExternalAccess.Razor.csproj",
+ "src\\NuGet\\Microsoft.Net.Compilers.Toolset\\Microsoft.Net.Compilers.Toolset.Package.csproj",
+ "src\\Features\\LanguageServer\\Protocol\\Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj",
+ "src\\Tools\\ExternalAccess\\Debugger\\Microsoft.CodeAnalysis.ExternalAccess.Debugger.csproj",
+ "src\\Tools\\ExternalAccess\\Xamarin.Remote\\Microsoft.CodeAnalysis.ExternalAccess.Xamarin.Remote.csproj",
+ "src\\Tools\\ExternalAccess\\Apex\\Microsoft.CodeAnalysis.ExternalAccess.Apex.csproj",
+ "src\\Tools\\IdeBenchmarks\\IdeBenchmarks.csproj",
+ "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\IOperationGenerator\\CompilersIOperationGenerator.csproj",
+ "src\\Features\\Lsif\\Generator\\Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\Core\\CompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\Core\\WorkspaceExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\CSharp\\CSharpCompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\CSharp\\CSharpWorkspaceExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Compiler\\VisualBasic\\VisualBasicCompilerExtensions.shproj",
+ "src\\Workspaces\\SharedUtilitiesAndExtensions\\Workspace\\VisualBasic\\VisualBasicWorkspaceExtensions.shproj",
+ "src\\Analyzers\\Core\\Analyzers\\Analyzers.shproj",
+ "src\\Analyzers\\Core\\CodeFixes\\CodeFixes.shproj",
+ "src\\Analyzers\\CSharp\\Analyzers\\CSharpAnalyzers.shproj",
+ "src\\Analyzers\\CSharp\\CodeFixes\\CSharpCodeFixes.shproj",
+ "src\\Analyzers\\VisualBasic\\Analyzers\\VisualBasicAnalyzers.shproj",
+ "src\\Analyzers\\VisualBasic\\CodeFixes\\VisualBasicCodeFixes.shproj",
+ "src\\Tools\\IdeCoreBenchmarks\\IdeCoreBenchmarks.csproj",
+ "src\\Tools\\BuildValidator\\BuildValidator.csproj",
+ "src\\Tools\\BuildActionTelemetryTable\\BuildActionTelemetryTable.csproj",
+ "src\\CodeStyle\\Tools\\CodeStyleConfigFileGenerator.csproj",
+ "src\\Dependencies\\Collections\\Microsoft.CodeAnalysis.Collections.shproj",
+ "src\\Dependencies\\Collections\\Microsoft.CodeAnalysis.Collections.Package.csproj",
+ "src\\Compilers\\Core\\Rebuild\\Microsoft.CodeAnalysis.Rebuild.csproj",
+ "src\\Tools\\ExternalAccess\\OmniSharp\\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.csproj",
+ "src\\Tools\\ExternalAccess\\OmniSharp.CSharp\\Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.CSharp.csproj",
+ "src\\Workspaces\\Remote\\ServiceHub.CoreComponents\\Microsoft.CodeAnalysis.Remote.ServiceHub.CoreComponents.csproj"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index 92e316a4744..9905b35467e 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -11,7 +11,7 @@
-->
<Target Name="ConfigureInnerBuildArg" BeforeTargets="GetSourceBuildCommandConfiguration">
<PropertyGroup>
- <InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.sln"</InnerBuildArgs>
+ <InnerBuildArgs>$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.SourceBuild.slnf"</InnerBuildArgs>
</PropertyGroup>
</Target>
--
2.31.1

View file

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MichaelSimons <msimons@microsoft.com>
Date: Sat, 19 Feb 2022 12:12:32 +0000
Subject: [PATCH] Define SystemReflectionMetadataLoadContextVersion property
for package references
System.Reflection.MetadataLoadContext references were using an incorrect version.props property which breaks source-build.
In 6.0.3 SystemReflectionMetadataVersion was revved but not SystemReflectionMetadataLoadContextVersion therefore breaking
the build because a System.Reflection.MetadataLoadContext with the SystemReflectionMetadataVersion does not exist.
---
eng/Versions.props | 1 +
src/tasks/WasmAppBuilder/WasmAppBuilder.csproj | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/eng/Versions.props b/eng/Versions.props
index 5e9d0039096..34034aa87ba 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -86,6 +86,7 @@
<SystemReflectionMetadataVersion>5.0.0</SystemReflectionMetadataVersion>
<!-- Static version does not get updated with the latest version during source-builds. -->
<SystemReflectionMetadataStaticVersion>5.0.0</SystemReflectionMetadataStaticVersion>
+ <SystemReflectionMetadataLoadContextVersion>5.0.0</SystemReflectionMetadataLoadContextVersion>
<SystemReflectionEmitVersion>4.7.0</SystemReflectionEmitVersion>
<SystemReflectionEmitILGenerationVersion>4.7.0</SystemReflectionEmitILGenerationVersion>
<SystemReflectionEmitLightweightVersion>4.7.0</SystemReflectionEmitLightweightVersion>
diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
index 358de5541e3..abf6d26d9ef 100644
--- a/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
+++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.csproj
@@ -23,11 +23,11 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkForNETCoreTasks)'">
- <PackageReference Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataVersion)" />
+ <PackageReference Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataLoadContextVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkForNETFrameworkTasks)'">
- <PackageReference Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataVersion)" PrivateAssets="all" />
+ <PackageReference Include="System.Reflection.MetadataLoadContext" Version="$(SystemReflectionMetadataLoadContextVersion)" PrivateAssets="all" />
<!-- match was MonoTargets tasks have -->
<!-- These versions should not be newer than what Visual Studio MSBuild uses -->

View file

@ -85,13 +85,21 @@
</ItemGroup>
<ItemGroup>
<BundledTemplates Include="@(Bundled60Templates)" TemplateFrameworkVersion="6.0"/>
<BundledTemplates Include="@(Bundled50Templates)" TemplateFrameworkVersion="5.0"/>
<BundledTemplates Include="@(Bundled31Templates)" TemplateFrameworkVersion="3.1"/>
<BundledTemplates Include="@(Bundled30Templates)" TemplateFrameworkVersion="3.0"/>
<BundledTemplates Include="@(Bundled21Templates)" TemplateFrameworkVersion="2.1"/>
<CurrentVersionBundledTemplates Include="@(Bundled60Templates)" TemplateFrameworkVersion="6.0"/>
</ItemGroup>
<ItemGroup>
<PreviousVersionBundledTemplates Include="@(Bundled50Templates)" TemplateFrameworkVersion="5.0"/>
<PreviousVersionBundledTemplates Include="@(Bundled31Templates)" TemplateFrameworkVersion="3.1"/>
<PreviousVersionBundledTemplates Include="@(Bundled30Templates)" TemplateFrameworkVersion="3.0"/>
<PreviousVersionBundledTemplates Include="@(Bundled21Templates)" TemplateFrameworkVersion="2.1"/>
</ItemGroup>
<ItemGroup>
<BundledTemplates Include="@(CurrentVersionBundledTemplates)" />
<BundledTemplates Include="@(PreviousVersionBundledTemplates)" Condition="$(ProductMonikerRid.StartsWith('win'))" />
</ItemGroup>
<ItemGroup>
<BundledTemplates Update="@(BundledTemplates)">
<NupkgPathRelativeToPackageRoot>%(Identity)/%(PackageVersion)/%(Identity).%(PackageVersion).nupkg</NupkgPathRelativeToPackageRoot>