Skip to content

Commit 9e46ef4

Browse files
authored
Backport select changes and fixes (#5615)
- **Add uncompressed manifest generation to SOS build (#5603)** - **Allow to run diagnostics pipeline in build-only mode (#5613)** - **Fix packaging issues in SOS containing packages (#5611)**
2 parents 2d64146 + 0c2eebc commit 9e46ef4

File tree

9 files changed

+212
-138
lines changed

9 files changed

+212
-138
lines changed

diagnostics.yml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ parameters:
1515
- default
1616
- custom
1717
- dotnetclimsrc-sas-token-base64
18+
- name: buildOnly
19+
displayName: Build only (skip tests)
20+
type: boolean
21+
default: false
1822

1923
trigger: none
2024

@@ -75,6 +79,7 @@ extends:
7579
jobTemplate: ${{ variables.jobTemplate }}
7680
name: Windows
7781
osGroup: Windows_NT
82+
buildOnly: ${{ parameters.buildOnly }}
7883
buildConfigs:
7984
- configuration: Debug
8085
architecture: x64
@@ -129,6 +134,7 @@ extends:
129134
parameters:
130135
jobTemplate: ${{ variables.jobTemplate }}
131136
osGroup: MacOS
137+
buildOnly: ${{ parameters.buildOnly }}
132138
buildConfigs:
133139
- configuration: Release
134140
architecture: x64
@@ -212,45 +218,13 @@ extends:
212218
# #
213219
############################
214220

215-
- template: /eng/pipelines/build.yml
216-
parameters:
217-
jobTemplate: ${{ variables.jobTemplate }}
218-
name: Ubuntu_22_04
219-
osGroup: Linux
220-
container: test_ubuntu_22_04
221-
dependsOn: Linux
222-
testOnly: true
223-
buildConfigs:
224-
- configuration: Release
225-
architecture: x64
226-
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
227-
- configuration: Debug
228-
architecture: x64
229-
230-
- template: /eng/pipelines/build.yml
231-
parameters:
232-
jobTemplate: ${{ variables.jobTemplate }}
233-
name: Alpine3_19
234-
osGroup: Linux
235-
osSuffix: -musl
236-
container: test_linux_musl_x64
237-
dependsOn: Linux_musl
238-
testOnly: true
239-
disableComponentGovernance: true
240-
buildConfigs:
241-
- configuration: Release
242-
architecture: x64
243-
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
244-
- configuration: Debug
245-
architecture: x64
246-
247-
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
221+
- ${{ if ne(parameters.buildOnly, true) }}:
248222
- template: /eng/pipelines/build.yml
249223
parameters:
250224
jobTemplate: ${{ variables.jobTemplate }}
251-
name: Debian_Bullseye
225+
name: Ubuntu_22_04
252226
osGroup: Linux
253-
container: test_debian_11_amd64
227+
container: test_ubuntu_22_04
254228
dependsOn: Linux
255229
testOnly: true
256230
buildConfigs:
@@ -263,18 +237,51 @@ extends:
263237
- template: /eng/pipelines/build.yml
264238
parameters:
265239
jobTemplate: ${{ variables.jobTemplate }}
266-
name: Fedora_39
240+
name: Alpine3_19
267241
osGroup: Linux
268-
container: test_fedora
269-
dependsOn: Linux
242+
osSuffix: -musl
243+
container: test_linux_musl_x64
244+
dependsOn: Linux_musl
270245
testOnly: true
246+
disableComponentGovernance: true
271247
buildConfigs:
272248
- configuration: Release
273249
architecture: x64
274250
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
275251
- configuration: Debug
276252
architecture: x64
277253

254+
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
255+
- template: /eng/pipelines/build.yml
256+
parameters:
257+
jobTemplate: ${{ variables.jobTemplate }}
258+
name: Debian_Bullseye
259+
osGroup: Linux
260+
container: test_debian_11_amd64
261+
dependsOn: Linux
262+
testOnly: true
263+
buildConfigs:
264+
- configuration: Release
265+
architecture: x64
266+
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
267+
- configuration: Debug
268+
architecture: x64
269+
270+
- template: /eng/pipelines/build.yml
271+
parameters:
272+
jobTemplate: ${{ variables.jobTemplate }}
273+
name: Fedora_39
274+
osGroup: Linux
275+
container: test_fedora
276+
dependsOn: Linux
277+
testOnly: true
278+
buildConfigs:
279+
- configuration: Release
280+
architecture: x64
281+
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
282+
- configuration: Debug
283+
architecture: x64
284+
278285
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
279286
- stage: package
280287
displayName: Package, Sign, and Generate BAR Manifests
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
using System.Xml.Linq;
4+
using System.Xml.XPath;
5+
6+
const string ExpectedParameters = "<GalleryManifestBaseTemplate> <GalleryManifestPath> <CompressedManifestPath> <ExtensionVersion>";
7+
8+
const string FilesXpathInPackageElement = "Components/BinaryComponent/Files";
9+
const string CompressedGalleryManifestTemplate = """
10+
<?xml version="1.0" encoding="utf-8"?>
11+
<ExtensionPackages Version="1.0.0.0" Compression="none">
12+
</ExtensionPackages>
13+
""";
14+
15+
if (args is null || args.Length != 4)
16+
{
17+
Console.Error.WriteLine("Expected parameters: {0}", ExpectedParameters);
18+
return -1;
19+
}
20+
21+
string galleryManifestBaseTemplate = args[0];
22+
string galleryManifestPath = args[1];
23+
string uncompressedManifestPath = args[2];
24+
string extensionVersion = args[3];
25+
26+
// Compressed and uncompressed manifests are the same for SOS except for two main differences:
27+
// - The compressed manifest has the ExtensionPackage as a top level element, while the uncompressed manifest has ExtensionPackages as the top level element
28+
// with Compression="none" attribute. The uncompressed manifest contains a single ExtensionPackage element with the ExtensionPackage that would appear in
29+
// the compressed manifest as a child element.
30+
// - The uncompressed manifest's ExtensionPackage contains a single File element pointing to the architecture-specific extension installed by the win SDK installer.
31+
// The compressed manifest's ExtensionPackage contains a File element per architecture as the extension gallery ships all of them in one.
32+
Console.WriteLine("Generating manifests for SOS version {0}", extensionVersion);
33+
34+
XDocument galleryManifest = XDocument.Load(galleryManifestBaseTemplate);
35+
XElement extensionPackageElement = galleryManifest.Root!;
36+
extensionPackageElement.XPathSelectElement("Version")!.Value = extensionVersion;
37+
38+
// Create uncompressed manifest with the updated version.
39+
XDocument uncompressedGalleryManifest = XDocument.Parse(CompressedGalleryManifestTemplate);
40+
XElement extensionPackageInCompressedManifest = new(extensionPackageElement);
41+
uncompressedGalleryManifest.Root!.Add(extensionPackageInCompressedManifest);
42+
43+
Console.WriteLine("Generating extension gallery manifest.");
44+
// Update compressed/regular manifest to have a File element per RID since the gallery ships all architectures in one package.
45+
XElement files = extensionPackageElement.XPathSelectElement(FilesXpathInPackageElement)!;
46+
files.RemoveNodes();
47+
files.Add(
48+
new XElement("File", new XAttribute("Architecture", "amd64"), new XAttribute("Module", "win-x64\\sos.dll")),
49+
new XElement("File", new XAttribute("Architecture", "x86"), new XAttribute("Module", "win-x86\\sos.dll")),
50+
new XElement("File", new XAttribute("Architecture", "arm64"), new XAttribute("Module", "win-arm64\\sos.dll")));
51+
52+
// Create folder if it doesn't exist and save the gallery manifest.
53+
Directory.CreateDirectory(Path.GetDirectoryName(galleryManifestPath)!);
54+
galleryManifest.Save(galleryManifestPath);
55+
56+
Console.WriteLine("Generating debugger layout (uncompressed) manifest.");
57+
// Update uncompressed manifest to have a single File element pointing to the winext\sos\sos.dll path.
58+
// The installer is responsible for installing the correct architecture-specific DLL.
59+
XElement uncompressedFiles = extensionPackageInCompressedManifest.XPathSelectElement(FilesXpathInPackageElement)!;
60+
uncompressedFiles.RemoveNodes();
61+
uncompressedFiles.Add(
62+
new XElement("File", new XAttribute("Architecture", "Any"), new XAttribute("Module", "winext\\sos\\sos.dll"), new XAttribute("FilePathKind", "RepositoryRelative")));
63+
Directory.CreateDirectory(Path.GetDirectoryName(uncompressedManifestPath)!);
64+
uncompressedGalleryManifest.Save(uncompressedManifestPath);
65+
66+
Console.WriteLine("Done.");
67+
return 0;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ExtensionPackage>
3+
<Name>SOS</Name>
4+
<Version />
5+
<Description>Debugging aid for .NET Core programs and runtimes</Description>
6+
<Components>
7+
<BinaryComponent Name="sos" Type="Engine">
8+
<Files />
9+
<LoadTriggers>
10+
<TriggerSet>
11+
<ModuleTrigger Name="coreclr.dll" />
12+
</TriggerSet>
13+
<TriggerSet>
14+
<ModuleTrigger Name="libcoreclr.so" />
15+
</TriggerSet>
16+
<TriggerSet>
17+
<ExceptionTrigger ExceptionCode="0xC0000409">
18+
<Parameters>
19+
<Parameter Index="0" Value="0x48" />
20+
</Parameters>
21+
</ExceptionTrigger>
22+
</TriggerSet>
23+
<TriggerSet>
24+
<ExceptionTrigger ExceptionCode="0xC000027B" />
25+
</TriggerSet>
26+
<TriggerSet>
27+
<ExceptionTrigger ExceptionCode="0xC000027C" />
28+
</TriggerSet>
29+
</LoadTriggers>
30+
<EngineCommands>
31+
<EngineCommand Name="soshelp">
32+
<EngineCommandItem>
33+
<Syntax>!soshelp</Syntax>
34+
<Description>Displays all available SOS commands or details about the command</Description>
35+
</EngineCommandItem>
36+
</EngineCommand>
37+
</EngineCommands>
38+
</BinaryComponent>
39+
</Components>
40+
</ExtensionPackage>

src/SOS/SOS.Package/SOS.Package.csproj

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
<IsPackable>true</IsPackable>
1010
<IncludeBuildOutput>false</IncludeBuildOutput>
1111
<SOSPackagePathPrefix>tools</SOSPackagePathPrefix>
12-
<GalleryManifestName>$(ArtifactsPackagesDir)\GalleryManifest.xml</GalleryManifestName>
12+
<GalleryManifestBase>$(MSBuildThisFileDirectory)ManifestBase.xml</GalleryManifestBase>
13+
<ExtensionGalleryManifestOutputFile>$(IntermediateOutputPath)sos_GalleryManifest.xml</ExtensionGalleryManifestOutputFile>
14+
<UncompressedGalleryManifestOutputFile>$(IntermediateOutputPath)GalleryManifest.xml</UncompressedGalleryManifestOutputFile>
1315
<BeforePack>GenerateGalleryManifest</BeforePack>
1416
<IsShipping>true</IsShipping>
1517
<IsShippingPackage>false</IsShippingPackage>
@@ -22,72 +24,30 @@
2224
<Target Name="Build" />
2325

2426
<ItemGroup>
25-
<None Include="$(GalleryManifestName)" Pack="true" Visible="false">
27+
<Compile Remove="**/*.cs" />
28+
<None Include="$(ExtensionGalleryManifestOutputFile)" Pack="true" Visible="false">
29+
<PackagePath>$(SOSPackagePathPrefix)</PackagePath>
30+
</None>
31+
<None Include="$(UncompressedGalleryManifestOutputFile)" Pack="true" Visible="false">
2632
<PackagePath>$(SOSPackagePathPrefix)</PackagePath>
2733
</None>
2834
<None Include="$(SOSExtensionsBinaries)" Pack="true" Visible="false">
2935
<PackagePath>$(SOSPackagePathPrefix)/lib</PackagePath>
3036
</None>
3137
</ItemGroup>
3238

39+
<!-- This target generates the gallery manifest files, both the extension gallery format and
40+
the uncompressed one used by the SDK installer. -->
3341
<Target Name="GenerateGalleryManifest"
3442
DependsOnTargets="GetAssemblyVersion;AddSourceRevisionToInformationalVersion">
35-
<PropertyGroup>
36-
<GalleryManifestLines>
37-
<![CDATA[
38-
<?xml version="1.0" encoding="utf-8"?>
39-
<ExtensionPackage>
40-
<Name>SOS</Name>
41-
<Version>$(FileVersion)</Version>
42-
<Description>Debugging aid for .NET Core programs and runtimes</Description>
43-
<Components>
44-
<BinaryComponent Name="sos" Type="Engine">
45-
<Files>
46-
<File Architecture="amd64" Module="win-x64\sos.dll" />
47-
<File Architecture="x86" Module="win-x86\sos.dll" />
48-
<File Architecture="arm64" Module="win-arm64\sos.dll" />
49-
</Files>
50-
<LoadTriggers>
51-
<TriggerSet>
52-
<ModuleTrigger Name="coreclr.dll" />
53-
</TriggerSet>
54-
<TriggerSet>
55-
<ModuleTrigger Name="libcoreclr.so" />
56-
</TriggerSet>
57-
<TriggerSet>
58-
<ExceptionTrigger ExceptionCode="0xC0000409">
59-
<Parameters>
60-
<Parameter Index="0" Value="0x48" />
61-
</Parameters>
62-
</ExceptionTrigger>
63-
</TriggerSet>
64-
<TriggerSet>
65-
<ExceptionTrigger ExceptionCode="0xC000027B" />
66-
</TriggerSet>
67-
<TriggerSet>
68-
<ExceptionTrigger ExceptionCode="0xC000027C" />
69-
</TriggerSet>
70-
</LoadTriggers>
71-
<EngineCommands>
72-
<EngineCommand Name="soshelp">
73-
<EngineCommandItem>
74-
<Syntax>!soshelp</Syntax>
75-
<Description>Displays all available SOS commands or details about the command</Description>
76-
</EngineCommandItem>
77-
</EngineCommand>
78-
</EngineCommands>
79-
</BinaryComponent>
80-
</Components>
81-
</ExtensionPackage>
82-
]]>
83-
</GalleryManifestLines>
84-
</PropertyGroup>
8543

86-
<WriteLinesToFile File="$(GalleryManifestName)" Lines="$(GalleryManifestLines)" Overwrite="true" />
44+
<Exec Command="$(DotNetTool) run --file $(MSBuildThisFileDirectory)GenerateManifest\GenerateManifest.cs &quot;$(GalleryManifestBase)&quot; &quot;$(ExtensionGalleryManifestOutputFile)&quot; &quot;$(UncompressedGalleryManifestOutputFile)&quot; &quot;$(FileVersion)&quot;" />
8745

8846
<ItemGroup>
89-
<FileWrites Include="$(GalleryManifestName)" />
47+
<FileWrites Include="$(ExtensionGalleryManifestOutputFile)" />
48+
<FileWrites Include="$(UncompressedGalleryManifestOutputFile)" />
9049
</ItemGroup>
50+
9151
</Target>
9252

9353
</Project>

src/SOS/SOS.Package/SOS.Symbol.Package.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17+
<Compile Remove="**/*.cs" />
1718
<None Include="$(ArtifactsBinDir)\SOS.Extensions\$(Configuration)\netstandard2.0\publish\*.pdb" Pack="true" Visible="false">
1819
<PackagePath>$(SOSPackagePathPrefix)/lib</PackagePath>
1920
</None>

src/Tools/dotnet-dump/dotnet-dump.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,4 @@
3737
</ItemGroup>
3838

3939
<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.props" />
40-
41-
<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.targets" />
4240
</Project>

src/Tools/dotnet-sos/dotnet-sos.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@
2929
<CopyToOutputDirectory Condition="'$(PublishSingleFile)' == 'true'">PreserveNewest</CopyToOutputDirectory>
3030
</None>
3131
</ItemGroup>
32-
33-
<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.targets" />
3432
</Project>

0 commit comments

Comments
 (0)