Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 45 additions & 38 deletions diagnostics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ parameters:
- default
- custom
- dotnetclimsrc-sas-token-base64
- name: buildOnly
displayName: Build only (skip tests)
type: boolean
default: false

trigger: none

Expand Down Expand Up @@ -75,6 +79,7 @@ extends:
jobTemplate: ${{ variables.jobTemplate }}
name: Windows
osGroup: Windows_NT
buildOnly: ${{ parameters.buildOnly }}
buildConfigs:
- configuration: Debug
architecture: x64
Expand Down Expand Up @@ -129,6 +134,7 @@ extends:
parameters:
jobTemplate: ${{ variables.jobTemplate }}
osGroup: MacOS
buildOnly: ${{ parameters.buildOnly }}
buildConfigs:
- configuration: Release
architecture: x64
Expand Down Expand Up @@ -212,45 +218,13 @@ extends:
# #
############################

- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Ubuntu_22_04
osGroup: Linux
container: test_ubuntu_22_04
dependsOn: Linux
testOnly: true
buildConfigs:
- configuration: Release
architecture: x64
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- configuration: Debug
architecture: x64

- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Alpine3_19
osGroup: Linux
osSuffix: -musl
container: test_linux_musl_x64
dependsOn: Linux_musl
testOnly: true
disableComponentGovernance: true
buildConfigs:
- configuration: Release
architecture: x64
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- configuration: Debug
architecture: x64

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.buildOnly, true) }}:
- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Debian_Bullseye
name: Ubuntu_22_04
osGroup: Linux
container: test_debian_11_amd64
container: test_ubuntu_22_04
dependsOn: Linux
testOnly: true
buildConfigs:
Expand All @@ -263,18 +237,51 @@ extends:
- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Fedora_39
name: Alpine3_19
osGroup: Linux
container: test_fedora
dependsOn: Linux
osSuffix: -musl
container: test_linux_musl_x64
dependsOn: Linux_musl
testOnly: true
disableComponentGovernance: true
buildConfigs:
- configuration: Release
architecture: x64
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- configuration: Debug
architecture: x64

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Debian_Bullseye
osGroup: Linux
container: test_debian_11_amd64
dependsOn: Linux
testOnly: true
buildConfigs:
- configuration: Release
architecture: x64
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- configuration: Debug
architecture: x64

- template: /eng/pipelines/build.yml
parameters:
jobTemplate: ${{ variables.jobTemplate }}
name: Fedora_39
osGroup: Linux
container: test_fedora
dependsOn: Linux
testOnly: true
buildConfigs:
- configuration: Release
architecture: x64
- ${{ if in(variables['Build.Reason'], 'PullRequest') }}:
- configuration: Debug
architecture: x64

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- stage: package
displayName: Package, Sign, and Generate BAR Manifests
Expand Down
67 changes: 67 additions & 0 deletions src/SOS/SOS.Package/GenerateManifest/GenerateManifest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Xml.Linq;
using System.Xml.XPath;

const string ExpectedParameters = "<GalleryManifestBaseTemplate> <GalleryManifestPath> <CompressedManifestPath> <ExtensionVersion>";

const string FilesXpathInPackageElement = "Components/BinaryComponent/Files";
const string CompressedGalleryManifestTemplate = """
<?xml version="1.0" encoding="utf-8"?>
<ExtensionPackages Version="1.0.0.0" Compression="none">
</ExtensionPackages>
""";

if (args is null || args.Length != 4)
{
Console.Error.WriteLine("Expected parameters: {0}", ExpectedParameters);
return -1;
}

string galleryManifestBaseTemplate = args[0];
string galleryManifestPath = args[1];
string uncompressedManifestPath = args[2];
string extensionVersion = args[3];

// Compressed and uncompressed manifests are the same for SOS except for two main differences:
// - The compressed manifest has the ExtensionPackage as a top level element, while the uncompressed manifest has ExtensionPackages as the top level element
// with Compression="none" attribute. The uncompressed manifest contains a single ExtensionPackage element with the ExtensionPackage that would appear in
// the compressed manifest as a child element.
// - The uncompressed manifest's ExtensionPackage contains a single File element pointing to the architecture-specific extension installed by the win SDK installer.
// The compressed manifest's ExtensionPackage contains a File element per architecture as the extension gallery ships all of them in one.
Console.WriteLine("Generating manifests for SOS version {0}", extensionVersion);

XDocument galleryManifest = XDocument.Load(galleryManifestBaseTemplate);
XElement extensionPackageElement = galleryManifest.Root!;
extensionPackageElement.XPathSelectElement("Version")!.Value = extensionVersion;

// Create uncompressed manifest with the updated version.
XDocument uncompressedGalleryManifest = XDocument.Parse(CompressedGalleryManifestTemplate);
XElement extensionPackageInCompressedManifest = new(extensionPackageElement);
uncompressedGalleryManifest.Root!.Add(extensionPackageInCompressedManifest);

Console.WriteLine("Generating extension gallery manifest.");
// Update compressed/regular manifest to have a File element per RID since the gallery ships all architectures in one package.
XElement files = extensionPackageElement.XPathSelectElement(FilesXpathInPackageElement)!;
files.RemoveNodes();
files.Add(
new XElement("File", new XAttribute("Architecture", "amd64"), new XAttribute("Module", "win-x64\\sos.dll")),
new XElement("File", new XAttribute("Architecture", "x86"), new XAttribute("Module", "win-x86\\sos.dll")),
new XElement("File", new XAttribute("Architecture", "arm64"), new XAttribute("Module", "win-arm64\\sos.dll")));

// Create folder if it doesn't exist and save the gallery manifest.
Directory.CreateDirectory(Path.GetDirectoryName(galleryManifestPath)!);
galleryManifest.Save(galleryManifestPath);

Console.WriteLine("Generating debugger layout (uncompressed) manifest.");
// Update uncompressed manifest to have a single File element pointing to the winext\sos\sos.dll path.
// The installer is responsible for installing the correct architecture-specific DLL.
XElement uncompressedFiles = extensionPackageInCompressedManifest.XPathSelectElement(FilesXpathInPackageElement)!;
uncompressedFiles.RemoveNodes();
uncompressedFiles.Add(
new XElement("File", new XAttribute("Architecture", "Any"), new XAttribute("Module", "winext\\sos\\sos.dll"), new XAttribute("FilePathKind", "RepositoryRelative")));
Directory.CreateDirectory(Path.GetDirectoryName(uncompressedManifestPath)!);
uncompressedGalleryManifest.Save(uncompressedManifestPath);

Console.WriteLine("Done.");
return 0;
40 changes: 40 additions & 0 deletions src/SOS/SOS.Package/ManifestBase.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<ExtensionPackage>
<Name>SOS</Name>
<Version />
<Description>Debugging aid for .NET Core programs and runtimes</Description>
<Components>
<BinaryComponent Name="sos" Type="Engine">
<Files />
<LoadTriggers>
<TriggerSet>
<ModuleTrigger Name="coreclr.dll" />
</TriggerSet>
<TriggerSet>
<ModuleTrigger Name="libcoreclr.so" />
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC0000409">
<Parameters>
<Parameter Index="0" Value="0x48" />
</Parameters>
</ExceptionTrigger>
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC000027B" />
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC000027C" />
</TriggerSet>
</LoadTriggers>
<EngineCommands>
<EngineCommand Name="soshelp">
<EngineCommandItem>
<Syntax>!soshelp</Syntax>
<Description>Displays all available SOS commands or details about the command</Description>
</EngineCommandItem>
</EngineCommand>
</EngineCommands>
</BinaryComponent>
</Components>
</ExtensionPackage>
68 changes: 14 additions & 54 deletions src/SOS/SOS.Package/SOS.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<IsPackable>true</IsPackable>
<IncludeBuildOutput>false</IncludeBuildOutput>
<SOSPackagePathPrefix>tools</SOSPackagePathPrefix>
<GalleryManifestName>$(ArtifactsPackagesDir)\GalleryManifest.xml</GalleryManifestName>
<GalleryManifestBase>$(MSBuildThisFileDirectory)ManifestBase.xml</GalleryManifestBase>
<ExtensionGalleryManifestOutputFile>$(IntermediateOutputPath)sos_GalleryManifest.xml</ExtensionGalleryManifestOutputFile>
<UncompressedGalleryManifestOutputFile>$(IntermediateOutputPath)GalleryManifest.xml</UncompressedGalleryManifestOutputFile>
<BeforePack>GenerateGalleryManifest</BeforePack>
<IsShipping>true</IsShipping>
<IsShippingPackage>false</IsShippingPackage>
Expand All @@ -22,72 +24,30 @@
<Target Name="Build" />

<ItemGroup>
<None Include="$(GalleryManifestName)" Pack="true" Visible="false">
<Compile Remove="**/*.cs" />
<None Include="$(ExtensionGalleryManifestOutputFile)" Pack="true" Visible="false">
<PackagePath>$(SOSPackagePathPrefix)</PackagePath>
</None>
<None Include="$(UncompressedGalleryManifestOutputFile)" Pack="true" Visible="false">
<PackagePath>$(SOSPackagePathPrefix)</PackagePath>
</None>
<None Include="$(SOSExtensionsBinaries)" Pack="true" Visible="false">
<PackagePath>$(SOSPackagePathPrefix)/lib</PackagePath>
</None>
</ItemGroup>

<!-- This target generates the gallery manifest files, both the extension gallery format and
the uncompressed one used by the SDK installer. -->
<Target Name="GenerateGalleryManifest"
DependsOnTargets="GetAssemblyVersion;AddSourceRevisionToInformationalVersion">
<PropertyGroup>
<GalleryManifestLines>
<![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<ExtensionPackage>
<Name>SOS</Name>
<Version>$(FileVersion)</Version>
<Description>Debugging aid for .NET Core programs and runtimes</Description>
<Components>
<BinaryComponent Name="sos" Type="Engine">
<Files>
<File Architecture="amd64" Module="win-x64\sos.dll" />
<File Architecture="x86" Module="win-x86\sos.dll" />
<File Architecture="arm64" Module="win-arm64\sos.dll" />
</Files>
<LoadTriggers>
<TriggerSet>
<ModuleTrigger Name="coreclr.dll" />
</TriggerSet>
<TriggerSet>
<ModuleTrigger Name="libcoreclr.so" />
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC0000409">
<Parameters>
<Parameter Index="0" Value="0x48" />
</Parameters>
</ExceptionTrigger>
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC000027B" />
</TriggerSet>
<TriggerSet>
<ExceptionTrigger ExceptionCode="0xC000027C" />
</TriggerSet>
</LoadTriggers>
<EngineCommands>
<EngineCommand Name="soshelp">
<EngineCommandItem>
<Syntax>!soshelp</Syntax>
<Description>Displays all available SOS commands or details about the command</Description>
</EngineCommandItem>
</EngineCommand>
</EngineCommands>
</BinaryComponent>
</Components>
</ExtensionPackage>
]]>
</GalleryManifestLines>
</PropertyGroup>

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

<ItemGroup>
<FileWrites Include="$(GalleryManifestName)" />
<FileWrites Include="$(ExtensionGalleryManifestOutputFile)" />
<FileWrites Include="$(UncompressedGalleryManifestOutputFile)" />
</ItemGroup>

</Target>

</Project>
1 change: 1 addition & 0 deletions src/SOS/SOS.Package/SOS.Symbol.Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="**/*.cs" />
<None Include="$(ArtifactsBinDir)\SOS.Extensions\$(Configuration)\netstandard2.0\publish\*.pdb" Pack="true" Visible="false">
<PackagePath>$(SOSPackagePathPrefix)/lib</PackagePath>
</None>
Expand Down
2 changes: 0 additions & 2 deletions src/Tools/dotnet-dump/dotnet-dump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.props" />

<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.targets" />
</Project>
2 changes: 0 additions & 2 deletions src/Tools/dotnet-sos/dotnet-sos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@
<CopyToOutputDirectory Condition="'$(PublishSingleFile)' == 'true'">PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\sos-packaging.targets" />
</Project>
Loading