Merge pull request #1062 from microsoft/libtemplateUpdate
Fix the OptProf pipeline
This commit is contained in:
Коммит
b6b568aa6c
|
@ -5,7 +5,7 @@
|
|||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
||||
<MessagePackVersion>2.5.108</MessagePackVersion>
|
||||
<MicroBuildVersion>2.0.152</MicroBuildVersion>
|
||||
<MicroBuildVersion>2.0.162</MicroBuildVersion>
|
||||
<VisualStudioThreadingVersion>17.10.48</VisualStudioThreadingVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
@ -34,13 +34,13 @@
|
|||
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
|
||||
<PackageVersion Include="xunit.combinatorial" Version="1.6.24" />
|
||||
<PackageVersion Include="xunit.runner.console" Version="2.5.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||
<PackageVersion Include="xunit.skippablefact" Version="1.4.13" />
|
||||
<PackageVersion Include="xunit.stafact" Version="1.1.11" />
|
||||
<PackageVersion Include="xunit" Version="2.8.1" />
|
||||
<PackageVersion Include="xunit" Version="2.9.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
|
||||
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" />
|
||||
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
|
||||
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4" />
|
||||
<GlobalPackageReference Include="Microsoft.CodeAnalysis.ResxSourceGenerator" Version="3.11.0-beta1.24122.1" />
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<!-- This file is only used in repos where OptProf is enabled. -->
|
||||
<metadata>
|
||||
<id>StreamJsonRpc.VSInsertionMetadata</id>
|
||||
<version>$version$</version>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
<projectUrl>https://github.com/Microsoft/vs-streamjsonrpc</projectUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Contains metadata for insertion into VS.</description>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="ProfilingInputs.props" target="InsertionVS/" />
|
||||
</files>
|
||||
</package>
|
|
@ -29,30 +29,7 @@ $result = @{
|
|||
|
||||
if ($env:IsOptProf) {
|
||||
$VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo"
|
||||
|
||||
$ArtifactBasePath = "$RepoRoot\obj\_artifacts"
|
||||
$ArtifactPath = "$ArtifactBasePath\VSInsertion"
|
||||
if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null }
|
||||
|
||||
$profilingInputs = [xml](Get-Content -Path "$PSScriptRoot\..\ProfilingInputs.props")
|
||||
$profilingInputs.Project.ItemGroup.TestStore.Include = "vstsdrop:" + (& "$PSScriptRoot\..\variables\ProfilingInputsDropName.ps1")
|
||||
$profilingInputs.Save("$ArtifactPath\ProfilingInputs.props")
|
||||
|
||||
$InsertionMetadataVersion = $(dotnet tool run nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion
|
||||
if ($env:BUILD_BUILDID) {
|
||||
# We must ensure unique versions for the insertion metadata package so
|
||||
# it can contain information that is unique to this build.
|
||||
# In particular it includes the ProfilingInputsDropName, which contains the BuildId.
|
||||
# A non-unique package version here may collide with a prior run of this same commit,
|
||||
# ultimately resulting in a failure of the optprof run.
|
||||
$InsertionMetadataVersion += '.' + $env:BUILD_BUILDID
|
||||
}
|
||||
& (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $VSRepoPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\StreamJsonRpc.VSInsertionMetadata.$InsertionMetadataVersion.nupkg");
|
||||
$result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\*.VSInsertionMetadata.*.nupkg");
|
||||
}
|
||||
|
||||
$result
|
||||
|
|
|
@ -37,9 +37,8 @@ steps:
|
|||
condition: and(succeeded(), ne(variables['OptProf'], 'true'), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||
|
||||
- ${{ if parameters.IsOptProf }}:
|
||||
# We have to artifically run this script so that the extra .nupkg is produced for variables/InsertPropsValues.ps1 to notice.
|
||||
- powershell: azure-pipelines\artifacts\VSInsertion.ps1
|
||||
displayName: 🔧 Prepare VSInsertion artifact
|
||||
- script: dotnet pack src\VSInsertionMetadata -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/VSInsertion-Pack.binlog"
|
||||
displayName: 🔧 dotnet pack VSInsertionMetadata
|
||||
|
||||
- powershell: azure-pipelines/variables/_pipelines.ps1
|
||||
failOnStderr: true
|
||||
|
|
|
@ -3,5 +3,8 @@
|
|||
"version": "8.0.300",
|
||||
"rollForward": "patch",
|
||||
"allowPrerelease": false
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.Build.NoTargets": "3.7.56"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.Build.NoTargets">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
|
||||
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\VSRepo\</PackageOutputPath>
|
||||
<IncludeSymbols>false</IncludeSymbols>
|
||||
<EnableDefaultSignFiles>false</EnableDefaultSignFiles>
|
||||
<Description>Contains metadata for insertion into VS.</Description>
|
||||
</PropertyGroup>
|
||||
<Import Project="VSInsertionMetadata.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,70 @@
|
|||
<Project>
|
||||
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
||||
<ParameterGroup>
|
||||
<InputFilename ParameterType="System.String" Required="true" />
|
||||
<OutputFilename ParameterType="System.String" Required="true" />
|
||||
<MatchExpression ParameterType="System.String" Required="true" />
|
||||
<ReplacementText ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Text.RegularExpressions" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
File.WriteAllText(
|
||||
OutputFilename,
|
||||
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
|
||||
);
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetsForTfmSpecificContentInPackage>
|
||||
$(TargetsForTfmSpecificContentInPackage);
|
||||
SubstituteProfilingInputsMacro;
|
||||
</TargetsForTfmSpecificContentInPackage>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="SubstituteProfilingInputsMacro">
|
||||
<ItemGroup>
|
||||
<ProfilingInputsSource Include="ProfilingInputs.props" />
|
||||
<ProfilingInputsTarget Include="$(IntermediateOutputPath)ProfilingInputs.props" />
|
||||
</ItemGroup>
|
||||
<ReplaceFileText
|
||||
Condition="'$(ProfilingInputsDropName)' != ''"
|
||||
InputFilename="@(ProfilingInputsSource)"
|
||||
OutputFilename="@(ProfilingInputsTarget)"
|
||||
MatchExpression="%TESTSTORE%"
|
||||
ReplacementText="vstsdrop:$(ProfilingInputsDropName)" />
|
||||
|
||||
<Warning
|
||||
Text="The ProfilingInputsDropName msbuild property has not been set, and the OptProf will not contain accurate content."
|
||||
Condition="'$(ProfilingInputsDropName)' == ''" />
|
||||
<Copy SourceFiles="@(ProfilingInputsSource)" DestinationFiles="@(ProfilingInputsTarget)"
|
||||
Condition="'$(ProfilingInputsDropName)' == ''" />
|
||||
|
||||
<ItemGroup>
|
||||
<TfmSpecificPackageFile Include="@(ProfilingInputsTarget)" PackagePath="InsertionVS/" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<Target Name="EnsureUniquePackageVersion"
|
||||
Condition="'$(Build_BuildId)' != ''"
|
||||
AfterTargets="GetBuildVersion">
|
||||
<!--
|
||||
We must ensure unique versions for the insertion metadata package so
|
||||
it can contain information that is unique to this build.
|
||||
In particular it includes the ProfilingInputsDropName, which contains the BuildId.
|
||||
A non-unique package version here may collide with a prior run of this same commit,
|
||||
ultimately resulting in a failure of the optprof run.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PackageVersion>$(PackageVersion).$(Build_BuildId)</PackageVersion>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
<Target Name="BreakForRename" BeforeTargets="Pack;GenerateNuspec" Condition="'$(MSBuildProjectName)'=='Library.VSInsertionMetadata'">
|
||||
<Error Text="This project should be renamed so the library name is used instead of 'Library'. Then delete this target." />
|
||||
</Target>
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче