Add support for building a PGO installer copy (#9877)

Uses the uninstrumented profiling PGO bits from the runtime when the
'-pgoinstrument' flag is set.
This commit is contained in:
Andy Gocke 2021-03-24 01:02:14 -07:00 committed by GitHub
parent e627233d2d
commit a98263b0da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 105 additions and 54 deletions

View file

@ -97,6 +97,29 @@ stages:
# Never run tests on arm64
_TestArg: ''
- template: /eng/build.yml
parameters:
agentOs: Windows_NT
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCorePublic-Pool
queue: buildpool.windows.10.amd64.vs2017.open
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: NetCoreInternal-Pool
queue: buildpool.windows.10.amd64.vs2017
timeoutInMinutes: 180
strategy:
matrix:
# Always run builds
Build_Release_x64:
_BuildConfig: Release
_BuildArchitecture: x64
_DOTNET_CLI_UI_LANGUAGE: ''
_AdditionalBuildParameters: '/p:PublishInternalAsset=true'
# Never run tests on PGO bits
_TestArg: ''
pgoInstrument: true
- template: /eng/build.yml
parameters:
agentOs: Linux
@ -270,7 +293,7 @@ stages:
- template: /eng/build.yml
parameters:
agentOs: Darwin
pool:
pool:
vmImage: 'macOS-10.15'
timeoutInMinutes: 180
strategy:
@ -291,7 +314,7 @@ stages:
# - template: /eng/build.yml
# parameters:
# agentOs: FreeBSD
# queue:
# queue:
# name: dnceng-freebsd-internal
# timeoutInMinutes: 180
# matrix:

View file

@ -12,6 +12,10 @@
<Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Architecture>
<Architecture Condition="'$(Architecture)' == ''">x64</Architecture>
</PropertyGroup>
<PropertyGroup Condition="'$(PgoInstrument)' == 'true'">
<SkipBuildingInstallers>true</SkipBuildingInstallers>
<PgoTerm>-pgo</PgoTerm>
</PropertyGroup>
<PropertyGroup>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>

View file

@ -20,7 +20,10 @@ parameters:
phases:
- template: /eng/common/templates/job/job.yml
parameters:
name: ${{ parameters.agentOs }}
${{ if parameters.pgoInstrument }}:
name: PGO_${{ parameters.agentOs }}
${{ if not(parameters.pgoInstrument) }}:
name: ${{ parameters.agentOs }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
${{ if eq(parameters.agentOs, 'Windows_NT') }}:
enableMicrobuild: true
@ -37,11 +40,20 @@ phases:
workspace:
clean: all
variables:
variables:
- _PgoInstrument: ''
- ${{ if eq(parameters.agentOs, 'Windows_NT') }}:
- _PackArg: '-pack'
- ${{ if ne(parameters.agentOs, 'Windows_NT') }}:
- _PackArg: '--pack'
- ${{ if parameters.pgoInstrument }}:
- _PgoInstrument: '/p:PgoInstrument=true'
- _PackArg: ''
- _AgentOSName: ${{ parameters.agentOs }}
- _TeamName: Roslyn-Project-System
- _SignType: test
- _BuildArgs: '/p:DotNetSignType=$(_SignType)'
- _BuildArgs: '/p:DotNetSignType=$(_SignType) $(_PgoInstrument)'
- _DOTNETCLIMSRC_READ_SAS_TOKEN: ''
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
@ -61,6 +73,7 @@ phases:
/p:DotNetSignType=$(_SignType)
/p:TeamName=$(_TeamName)
/p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
$(_PgoInstrument)
steps:
- checkout: self
@ -75,8 +88,8 @@ phases:
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- script: build.cmd
$(_TestArg)
-pack -publish -ci -sign
$(_TestArg) $(_PackArg)
-publish -ci -sign
-Configuration $(_BuildConfig)
-Architecture $(_BuildArchitecture)
$(_BuildArgs)
@ -97,8 +110,8 @@ phases:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if eq(parameters.agentOs, 'Linux') }}:
- script: ./build.sh
$(_TestArg)
--pack --publish --ci
$(_TestArg) $(_PackArg)
--publish --ci
--noprettyprint
--configuration $(_BuildConfig)
$(_DockerParameter)
@ -135,32 +148,32 @@ phases:
publishFeedCredentials: 'DevDiv - VS package feed'
condition: and(succeeded(), eq(variables['_PushToVSFeed'], 'true'), eq(variables['_DotNetPublishToBlobFeed'], 'true'), or(eq(variables['_BuildArchitecture'], 'x64'), eq(variables['_BuildArchitecture'], 'x86')))
- task: PublishTestResults@2
displayName: Publish Test Results
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testRunner: XUnit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
testRunTitle: '$(_AgentOSName)_$(Agent.JobName)'
platform: '$(BuildPlatform)'
configuration: '$(_BuildConfig)'
testRunner: XUnit
testResultsFiles: 'artifacts/TestResults/$(_BuildConfig)/*.xml'
testRunTitle: '$(_AgentOSName)_$(Agent.JobName)'
platform: '$(BuildPlatform)'
configuration: '$(_BuildConfig)'
condition: ne(variables['_TestArg'], '')
- task: CopyFiles@2
displayName: Gather Logs
- task: CopyFiles@2
displayName: Gather Logs
inputs:
SourceFolder: '$(Build.SourcesDirectory)/artifacts'
Contents: |
log/$(_BuildConfig)/**/*
TestResults/$(_BuildConfig)/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
continueOnError: true
SourceFolder: '$(Build.SourcesDirectory)/artifacts'
Contents: |
log/$(_BuildConfig)/**/*
TestResults/$(_BuildConfig)/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
continueOnError: true
condition: always()
- task: PublishBuildArtifacts@1
displayName: Publish Logs to VSTS
- task: PublishBuildArtifacts@1
displayName: Publish Logs to VSTS
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '$(_AgentOSName)_$(Agent.JobName)_$(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: '$(_AgentOSName)_$(Agent.JobName)_$(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
condition: always()

View file

@ -8,6 +8,7 @@ param(
[string]$Configuration="Debug",
[string]$Architecture="x64",
[switch]$Sign=$false,
[switch]$PgoInstrument,
[bool]$WarnAsError=$true,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$ExtraParameters
)
@ -17,6 +18,10 @@ $RepoRoot = "$PSScriptRoot"
$Parameters = "/p:Architecture=$Architecture"
$Parameters = "$Parameters -configuration $Configuration"
if ($PgoInstrument) {
$Parameters = "$Parameters /p:PgoInstrument=true"
}
if ($Sign) {
$Parameters = "$Parameters -sign /p:SignCoreSdk=true"

View file

@ -42,6 +42,9 @@ while [[ $# > 0 ]]; do
--linux-portable)
args+=("/p:Rid=linux-x64 /p:OSName=\"linux\" /p:IslinuxPortable=\"true\"")
;;
--pgoInstrument)
args+=("/p:PgoInstrument=true")
;;
--help)
echo "Usage: $0 [--configuration <CONFIGURATION>] [--architecture <ARCHITECTURE>] [--docker <IMAGENAME>] [--help]"
echo ""

View file

@ -8,7 +8,7 @@
Lines="$(PackageVersion)"
Overwrite="true"
Encoding="ASCII" />
<WriteLinesToFile
File="$(ArtifactsShippingPackagesDir)sdk-productVersion.txt"
Lines="$(PackageVersion)"
@ -54,19 +54,19 @@
<_NETCoreApp30RuntimePackVersion>3.0.3</_NETCoreApp30RuntimePackVersion>
<_NETCoreApp30TargetingPackVersion>3.0.0</_NETCoreApp30TargetingPackVersion>
<_NETCoreApp31RuntimePackVersion>3.1.$(VersionFeature31)</_NETCoreApp31RuntimePackVersion>
<_NETCoreApp31TargetingPackVersion>3.1.0</_NETCoreApp31TargetingPackVersion>
<_WindowsDesktop30RuntimePackVersion>3.0.3</_WindowsDesktop30RuntimePackVersion>
<_WindowsDesktop30TargetingPackVersion>3.0.0</_WindowsDesktop30TargetingPackVersion>
<_WindowsDesktop31RuntimePackVersion>3.1.$(VersionFeature31)</_WindowsDesktop31RuntimePackVersion>
<_WindowsDesktop31TargetingPackVersion>3.1.0</_WindowsDesktop31TargetingPackVersion>
<_AspNet30RuntimePackVersion>3.0.3</_AspNet30RuntimePackVersion>
<_AspNet30TargetingPackVersion>3.0.1</_AspNet30TargetingPackVersion>
<_AspNet31RuntimePackVersion>3.1.$(VersionFeature31)</_AspNet31RuntimePackVersion>
<_AspNet31TargetingPackVersion>3.1.10</_AspNet31TargetingPackVersion>
@ -101,7 +101,7 @@
@(NetCore31RuntimePackRids);
linux-musl-arm;
"/>
<Net50RuntimePackRids Include="
@(Net50AppHostRids);
ios-arm64;
@ -159,7 +159,7 @@
<GenerateDefaultRuntimeFrameworkVersion RuntimePackVersion="$(MicrosoftAspNetCoreAppRuntimePackageVersion)">
<Output TaskParameter="DefaultRuntimeFrameworkVersion" PropertyName="MicrosoftAspNetCoreAppDefaultRuntimeFrameworkVersion" />
</GenerateDefaultRuntimeFrameworkVersion>
<ItemGroup>
<ImplicitPackageVariable Include="Microsoft.NETCore.App"
TargetFrameworkVersion="1.0"
@ -199,11 +199,11 @@
DefaultVersion="2.2.0"
LatestVersion="2.2.8"/>
</ItemGroup>
<PropertyGroup>
<PortableProductMonikerRid Condition="'$(PortableProductMonikerRid)' == ''">$(ProductMonikerRid)</PortableProductMonikerRid>
</PropertyGroup>
<PropertyGroup>
<BundledVersionsPropsContent>
@ -223,7 +223,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<PropertyGroup>
<NetCoreRoot Condition="'%24(NetCoreRoot)' == ''">%24([MSBuild]::NormalizePath('%24(MSBuildThisFileDirectory)..\..\'))</NetCoreRoot>
<NetCoreTargetingPackRoot Condition="'%24(NetCoreTargetingPackRoot)' == ''">%24([MSBuild]::EnsureTrailingSlash('%24(NetCoreRoot)'))packs</NetCoreTargetingPackRoot>
<NETCoreAppMaximumVersion>$(_NETCoreAppTargetFrameworkVersion)</NETCoreAppMaximumVersion>
<BundledNETCoreAppTargetFrameworkVersion>$(_NETCoreAppTargetFrameworkVersion)</BundledNETCoreAppTargetFrameworkVersion>
<BundledNETCoreAppPackageVersion>$(_NETCoreAppPackageVersion)</BundledNETCoreAppPackageVersion>
@ -265,7 +265,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Crossgen2PackVersion="$(MicrosoftNETCoreAppRuntimePackageVersion)"
Crossgen2RuntimeIdentifiers="@(Crossgen2SupportedRids, '%3B')"
/>
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="net6.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
@ -380,7 +380,7 @@ Copyright (c) .NET Foundation. All rights reserved.
Crossgen2PackVersion="$(_NET50RuntimePackVersion)"
Crossgen2RuntimeIdentifiers="@(Net50Crossgen2SupportedRids, '%3B')"
/>
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="net5.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
@ -488,7 +488,7 @@ Copyright (c) .NET Foundation. All rights reserved.
AppHostPackVersion="$(_NETCoreApp31RuntimePackVersion)"
AppHostRuntimeIdentifiers="@(NetCore31RuntimePackRids, '%3B')"
/>
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="netcoreapp3.1"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
@ -558,7 +558,7 @@ Copyright (c) .NET Foundation. All rights reserved.
AppHostPackVersion="$(_NETCoreApp30RuntimePackVersion)"
AppHostRuntimeIdentifiers="@(NetCore30RuntimePackRids, '%3B')"
/>
<KnownFrameworkReference Include="Microsoft.WindowsDesktop.App"
TargetFramework="netcoreapp3.0"
RuntimeFrameworkName="Microsoft.WindowsDesktop.App"
@ -607,7 +607,7 @@ Copyright (c) .NET Foundation. All rights reserved.
RuntimePackNamePatterns="Microsoft.AspNetCore.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(AspNetCore30RuntimePackRids, '%3B')"
/>
<KnownFrameworkReference Include="NETStandard.Library"
TargetFramework="netstandard2.1"
TargetingPackName="NETStandard.Library.Ref"
@ -665,13 +665,13 @@ Copyright (c) .NET Foundation. All rights reserved.
DependsOnTargets="GenerateBundledVersionsProps">
<Copy SourceFiles="$(NuGetPackageRoot)/microsoft.netcore.platforms/$(_NETCorePlatformsPackageVersion)/runtime.json"
DestinationFiles="$(SdkOutputDirectory)RuntimeIdentifierGraph.json"
DestinationFiles="$(SdkOutputDirectory)RuntimeIdentifierGraph.json"
SkipUnchangedFiles="true"/>
<GenerateSdkRuntimeIdentifierChain
RuntimeIdentifier="$(PortableProductMonikerRid)"
RuntimeIdentifierGraphPath="$(SdkOutputDirectory)RuntimeIdentifierGraph.json"
RuntimeIdentifierChainOutputPath="$(SdkOutputDirectory)NETCoreSdkRuntimeIdentifierChain.txt"/>
</Target>
</Project>

View file

@ -5,6 +5,7 @@
</PropertyGroup>
<Target Name="GenerateInstallers"
Condition="'$(PgoInstrument)' != 'true'"
BeforeTargets="Pack"
DependsOnTargets="$(_BuildUnlessNoBuild);
GetCurrentRuntimeInformation;

View file

@ -3,6 +3,8 @@
<RedistLayoutPath>$(BaseOutputPath)$(Configuration)\dotnet\</RedistLayoutPath>
<SdkInternalLayoutPath>$(BaseOutputPath)$(Configuration)\dotnet-internal\</SdkInternalLayoutPath>
<DownloadsFolder>$(IntermediateOutputPath)downloads\</DownloadsFolder>
<!-- add -internal to use the internal builds, except for Mac which already uses internal builds -->
<PgoArchiveTerm Condition="'$(PgoTerm)' != '' AND !$([MSBuild]::IsOSPlatform('OSX'))">-internal$(PgoTerm)</PgoArchiveTerm>
</PropertyGroup>
<PropertyGroup>
@ -49,7 +51,7 @@
<AlternateArchitecture Condition="'$(Architecture)' == 'x64'">x86</AlternateArchitecture>
<DownloadedSharedHostInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-host$(InstallerStartSuffix)-$(SharedHostVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedSharedHostInstallerFileName>
<DownloadedHostFxrInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-hostfxr$(InstallerStartSuffix)-$(HostFxrVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedHostFxrInstallerFileName>
<DownloadedSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime$(InstallerStartSuffix)-$(MicrosoftNETCoreAppRuntimePackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedSharedFrameworkInstallerFileName>
<DownloadedSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime$(InstallerStartSuffix)$(PgoArchiveTerm)-$(MicrosoftNETCoreAppRuntimePackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedSharedFrameworkInstallerFileName>
<DownloadedRuntimeDepsInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-runtime-deps-$(SharedHostVersion)-$(RuntimeDepsInstallerFileRid)$(InstallerExtension)</DownloadedRuntimeDepsInstallerFileName>
<DownloadedWinFormsAndWpfSharedFrameworkInstallerFileName Condition=" '$(InstallerExtension)' != '' ">windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedWinFormsAndWpfSharedFrameworkInstallerFileName>
<DownloadedNetCoreAppTargetingPackInstallerFileName Condition=" '$(InstallerExtension)' != '' ">dotnet-targeting-pack-$(MicrosoftNETCoreAppRefPackageVersion)-$(SharedFrameworkInstallerFileRid)$(InstallerExtension)</DownloadedNetCoreAppTargetingPackInstallerFileName>
@ -70,7 +72,7 @@
<SharedFrameworkRid>$(CoreSetupRid)</SharedFrameworkRid>
<SharedFrameworkRid Condition="$(ProductMonikerRid.StartsWith('linux-musl'))">$(ProductMonikerRid)</SharedFrameworkRid>
<SharedFrameworkRid Condition=" '$(UsePortableLinuxSharedFramework)' == 'true' ">linux-$(Architecture)</SharedFrameworkRid>
<CombinedFrameworkHostArchiveFileName>dotnet-runtime-$(MicrosoftNETCoreAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</CombinedFrameworkHostArchiveFileName>
<CombinedFrameworkHostArchiveFileName>dotnet-runtime$(PgoTerm)-$(MicrosoftNETCoreAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</CombinedFrameworkHostArchiveFileName>
<WinFormsAndWpfSharedFxArchiveFileName>windowsdesktop-runtime-$(MicrosoftWindowsDesktopAppRuntimePackageVersion)-$(SharedFrameworkRid)$(ArchiveExtension)</WinFormsAndWpfSharedFxArchiveFileName>
<AspNetCoreSharedFxInstallerRid Condition="'$(AspNetCoreSharedFxInstallerRid)' == ''">$(SharedFrameworkRid)</AspNetCoreSharedFxInstallerRid>

View file

@ -12,7 +12,7 @@
<Rid Condition=" '$(Rid)' == '' ">$(OSName)-$(Architecture)</Rid>
</PropertyGroup>
<PropertyGroup>
<IsDebianBaseDistro Condition=" $(HostRid.StartsWith('ubuntu')) OR $(HostRid.StartsWith('debian')) ">true</IsDebianBaseDistro>
<IsRPMBasedDistro Condition=" $(HostRid.StartsWith('rhel')) AND '$(HostRid)' != 'rhel.6-x64' ">true</IsRPMBasedDistro>
@ -26,13 +26,13 @@
'$(Rid)' == 'linux-musl-x64' ">$(Rid)</ProductMonikerRid>
<ProductMonikerRid Condition=" '$(ProductMonikerRid)' == '' ">$(OSName)-$(Architecture)</ProductMonikerRid>
<ArtifactNameSdk>dotnet-sdk-internal</ArtifactNameSdk>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk</ArtifactNameCombinedHostHostFxrFrameworkSdk>
<ArtifactNameSdk>dotnet-sdk-internal$(PgoTerm)</ArtifactNameSdk>
<ArtifactNameCombinedHostHostFxrFrameworkSdk>dotnet-sdk$(PgoTerm)</ArtifactNameCombinedHostHostFxrFrameworkSdk>
<ArtifactNameWithVersionSdk>$(ArtifactNameSdk)-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionSdk>
<ArtifactNameWithVersionMSBuildExtensions>dotnet-standard-support-vs2015-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionMSBuildExtensions>
<ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)-$(ProductMonikerRid)</ArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>
<!-- Warning: changing the value "ProductBandCombinedHostHostFxrFrameworkSdkName" can only occur on a product-band boundary [CliProductBandVersion],
<!-- Warning: changing the value "ProductBandCombinedHostHostFxrFrameworkSdkName" can only occur on a product-band boundary [CliProductBandVersion],
Changing "ProductBandCombinedHostHostFxrFrameworkSdkName" mid-product-band will break the upgradablilty of the SDK bundle installer. -->
<ProductBandCombinedHostHostFxrFrameworkSdkName>Dotnet SDK Bundle Installer $(CliProductBandVersion) $(ProductMonikerRid)</ProductBandCombinedHostHostFxrFrameworkSdkName>
<DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>$(ArtifactNameCombinedHostHostFxrFrameworkSdk)-$(Version)-$(Architecture)</DistroSpecificArtifactNameWithVersionCombinedHostHostFxrFrameworkSdk>