Skip to content

Commit 09af24d

Browse files
authored
Merge pull request #1338 from microsoft/libtemplateUpdate
Fix the OptProf pipeline
2 parents c6d4307 + ce528a0 commit 09af24d

File tree

8 files changed

+106
-57
lines changed

8 files changed

+106
-57
lines changed

Directory.Packages.props

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
66
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
7-
<MicroBuildVersion>2.0.152</MicroBuildVersion>
7+
<MicroBuildVersion>2.0.162</MicroBuildVersion>
88
<CodeAnalysisVersion>3.11.0</CodeAnalysisVersion>
99
<CodeAnalysisVersion Condition="'$(IsTestProject)'=='true'">4.4.0</CodeAnalysisVersion>
1010
<CodefixTestingVersion>1.1.1</CodefixTestingVersion>
@@ -17,16 +17,23 @@
1717
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" />
1818
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="$(CodeAnalysisVersion)" />
1919
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="$(CodeAnalysisVersion)" />
20-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="$(CodefixTestingVersion)" />
21-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="$(CodefixTestingVersion)" />
20+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing"
21+
Version="$(CodefixTestingVersion)" />
22+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit"
23+
Version="$(CodefixTestingVersion)" />
2224
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.0-beta2.final" />
2325
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="$(CodeAnalysisVersion)" />
24-
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing" Version="$(CodefixTestingVersion)" />
25-
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit" Version="$(CodefixTestingVersion)" />
26-
<PackageVersion Include="Microsoft.Diagnostics.Runtime.Utilities" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
27-
<PackageVersion Include="Microsoft.Diagnostics.Runtime" Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
26+
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing"
27+
Version="$(CodefixTestingVersion)" />
28+
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.CodeFix.Testing.XUnit"
29+
Version="$(CodefixTestingVersion)" />
30+
<PackageVersion Include="Microsoft.Diagnostics.Runtime.Utilities"
31+
Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
32+
<PackageVersion Include="Microsoft.Diagnostics.Runtime"
33+
Version="$(MicrosoftDiagnosticsRuntimeVersion)" />
2834
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
29-
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping" Version="$(MicroBuildVersion)" />
35+
<PackageVersion Include="Microsoft.VisualStudio.Internal.MicroBuild.NonShipping"
36+
Version="$(MicroBuildVersion)" />
3037
<PackageVersion Include="Microsoft.VisualStudio.Interop" Version="17.4.33103.184" />
3138
<PackageVersion Include="Microsoft.VisualStudio.Shell.15.0" Version="17.4.33103.184" />
3239
<PackageVersion Include="Microsoft.VisualStudio.Shell.Framework" Version="17.4.33103.184" />
@@ -41,16 +48,17 @@
4148
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
4249
<PackageVersion Include="xunit.abstractions" Version="2.0.3" />
4350
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
44-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
51+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
4552
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
4653
<PackageVersion Include="Xunit.StaFact" Version="1.1.11" />
47-
<PackageVersion Include="xunit" Version="2.8.1" />
54+
<PackageVersion Include="xunit" Version="2.9.0" />
4855
</ItemGroup>
4956
<ItemGroup>
50-
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
57+
<GlobalPackageReference Include="CSharpIsNullAnalyzer" Version="0.1.593" />
5158
<GlobalPackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
5259
<GlobalPackageReference Include="IsExternalInit" Version="1.0.3" />
53-
<GlobalPackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio" Version="$(MicroBuildVersion)" />
60+
<GlobalPackageReference Include="Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio"
61+
Version="$(MicroBuildVersion)" />
5462
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.6.139" />
5563
<GlobalPackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556" />
5664
</ItemGroup>

azure-pipelines/InsertionMetadataPackage.nuspec

Lines changed: 0 additions & 17 deletions
This file was deleted.

azure-pipelines/artifacts/VSInsertion.ps1

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,7 @@ $result = @{
2929

3030
if ($env:IsOptProf) {
3131
$VSRepoPackages = "$RepoRoot/bin/Packages/$BuildConfiguration/VSRepo"
32-
33-
$ArtifactBasePath = "$RepoRoot\obj\_artifacts"
34-
$ArtifactPath = "$ArtifactBasePath\VSInsertion"
35-
if (-not (Test-Path $ArtifactPath)) { New-Item -ItemType Directory -Path $ArtifactPath | Out-Null }
36-
37-
$profilingInputs = [xml](Get-Content -Path "$PSScriptRoot\..\ProfilingInputs.props")
38-
$profilingInputs.Project.ItemGroup.TestStore.Include = "vstsdrop:" + (& "$PSScriptRoot\..\variables\ProfilingInputsDropName.ps1")
39-
$profilingInputs.Save("$ArtifactPath\ProfilingInputs.props")
40-
41-
$InsertionMetadataVersion = $(dotnet tool run nbgv get-version -p "$RepoRoot\src" -f json | ConvertFrom-Json).NuGetPackageVersion
42-
if ($env:BUILD_BUILDID) {
43-
# We must ensure unique versions for the insertion metadata package so
44-
# it can contain information that is unique to this build.
45-
# In particular it includes the ProfilingInputsDropName, which contains the BuildId.
46-
# A non-unique package version here may collide with a prior run of this same commit,
47-
# ultimately resulting in a failure of the optprof run.
48-
$InsertionMetadataVersion += '.' + $env:BUILD_BUILDID
49-
}
50-
& (& "$PSScriptRoot\..\Get-NuGetTool.ps1") pack "$PSScriptRoot\..\InsertionMetadataPackage.nuspec" -OutputDirectory $VSRepoPackages -BasePath $ArtifactPath -Version $InsertionMetadataVersion | Out-Null
51-
if ($LASTEXITCODE -ne 0) {
52-
exit $LASTEXITCODE
53-
}
54-
55-
$result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\Microsoft.VisualStudio.Threading.VSInsertionMetadata.$InsertionMetadataVersion.nupkg");
32+
$result["$VSRepoPackages"] = (Get-ChildItem "$VSRepoPackages\*.VSInsertionMetadata.*.nupkg");
5633
}
5734

5835
$result

azure-pipelines/dotnet.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ steps:
1717
condition: and(succeeded(), ${{ parameters.RunTests }})
1818

1919
- ${{ if parameters.IsOptProf }}:
20-
# We have to artifically run this script so that the extra .nupkg is produced for variables/InsertPropsValues.ps1 to notice.
21-
- powershell: azure-pipelines\artifacts\VSInsertion.ps1
22-
displayName: 🔧 Prepare VSInsertion artifact
20+
- script: dotnet pack src\VSInsertionMetadata -c $(BuildConfiguration) -warnaserror /bl:"$(Build.ArtifactStagingDirectory)/build_logs/VSInsertion-Pack.binlog"
21+
displayName: 🔧 dotnet pack VSInsertionMetadata
2322

2423
- powershell: azure-pipelines/variables/_pipelines.ps1
2524
failOnStderr: true

global.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"allowPrerelease": false
66
},
77
"msbuild-sdks": {
8-
"MSBuild.Sdk.Extras": "3.0.44"
8+
"MSBuild.Sdk.Extras": "3.0.44",
9+
"Microsoft.Build.NoTargets": "3.7.56"
910
}
1011
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.Build.NoTargets">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.0</TargetFramework>
4+
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
5+
<PackageOutputPath>$(RepoRootPath)bin\Packages\$(Configuration)\VSRepo\</PackageOutputPath>
6+
<IncludeSymbols>false</IncludeSymbols>
7+
<EnableDefaultSignFiles>false</EnableDefaultSignFiles>
8+
<Description>Contains metadata for insertion into VS.</Description>
9+
</PropertyGroup>
10+
<Import Project="VSInsertionMetadata.targets" />
11+
</Project>
File renamed without changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<Project>
2+
<UsingTask TaskName="ReplaceFileText" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
3+
<ParameterGroup>
4+
<InputFilename ParameterType="System.String" Required="true" />
5+
<OutputFilename ParameterType="System.String" Required="true" />
6+
<MatchExpression ParameterType="System.String" Required="true" />
7+
<ReplacementText ParameterType="System.String" Required="true" />
8+
</ParameterGroup>
9+
<Task>
10+
<Using Namespace="System" />
11+
<Using Namespace="System.IO" />
12+
<Using Namespace="System.Text.RegularExpressions" />
13+
<Code Type="Fragment" Language="cs">
14+
<![CDATA[
15+
File.WriteAllText(
16+
OutputFilename,
17+
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
18+
);
19+
]]>
20+
</Code>
21+
</Task>
22+
</UsingTask>
23+
24+
<PropertyGroup>
25+
<TargetsForTfmSpecificContentInPackage>
26+
$(TargetsForTfmSpecificContentInPackage);
27+
SubstituteProfilingInputsMacro;
28+
</TargetsForTfmSpecificContentInPackage>
29+
</PropertyGroup>
30+
31+
<Target Name="SubstituteProfilingInputsMacro">
32+
<ItemGroup>
33+
<ProfilingInputsSource Include="ProfilingInputs.props" />
34+
<ProfilingInputsTarget Include="$(IntermediateOutputPath)ProfilingInputs.props" />
35+
</ItemGroup>
36+
<ReplaceFileText
37+
Condition="'$(ProfilingInputsDropName)' != ''"
38+
InputFilename="@(ProfilingInputsSource)"
39+
OutputFilename="@(ProfilingInputsTarget)"
40+
MatchExpression="%TESTSTORE%"
41+
ReplacementText="vstsdrop:$(ProfilingInputsDropName)" />
42+
43+
<Warning
44+
Text="The ProfilingInputsDropName msbuild property has not been set, and the OptProf will not contain accurate content."
45+
Condition="'$(ProfilingInputsDropName)' == ''" />
46+
<Copy SourceFiles="@(ProfilingInputsSource)" DestinationFiles="@(ProfilingInputsTarget)"
47+
Condition="'$(ProfilingInputsDropName)' == ''" />
48+
49+
<ItemGroup>
50+
<TfmSpecificPackageFile Include="@(ProfilingInputsTarget)" PackagePath="InsertionVS/" />
51+
</ItemGroup>
52+
</Target>
53+
<Target Name="EnsureUniquePackageVersion"
54+
Condition="'$(Build_BuildId)' != ''"
55+
AfterTargets="GetBuildVersion">
56+
<!--
57+
We must ensure unique versions for the insertion metadata package so
58+
it can contain information that is unique to this build.
59+
In particular it includes the ProfilingInputsDropName, which contains the BuildId.
60+
A non-unique package version here may collide with a prior run of this same commit,
61+
ultimately resulting in a failure of the optprof run.
62+
-->
63+
<PropertyGroup>
64+
<PackageVersion>$(PackageVersion).$(Build_BuildId)</PackageVersion>
65+
</PropertyGroup>
66+
</Target>
67+
<Target Name="BreakForRename" BeforeTargets="Pack;GenerateNuspec" Condition="'$(MSBuildProjectName)'=='Library.VSInsertionMetadata'">
68+
<Error Text="This project should be renamed so the library name is used instead of 'Library'. Then delete this target." />
69+
</Target>
70+
</Project>

0 commit comments

Comments
 (0)