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

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
@ -38,10 +41,19 @@ phases:
clean: all
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)

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

@ -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

@ -26,8 +26,8 @@
'$(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>