diff --git a/diagnostics.yml b/diagnostics.yml index a6c816ae85..389526e741 100644 --- a/diagnostics.yml +++ b/diagnostics.yml @@ -15,6 +15,10 @@ parameters: - default - custom - dotnetclimsrc-sas-token-base64 +- name: buildOnly + displayName: Build only (skip tests) + type: boolean + default: false trigger: none @@ -75,6 +79,7 @@ extends: jobTemplate: ${{ variables.jobTemplate }} name: Windows osGroup: Windows_NT + buildOnly: ${{ parameters.buildOnly }} buildConfigs: - configuration: Debug architecture: x64 @@ -129,6 +134,7 @@ extends: parameters: jobTemplate: ${{ variables.jobTemplate }} osGroup: MacOS + buildOnly: ${{ parameters.buildOnly }} buildConfigs: - configuration: Release architecture: x64 @@ -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: @@ -263,11 +237,13 @@ 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 @@ -275,6 +251,37 @@ extends: - 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 diff --git a/src/SOS/SOS.Package/GenerateManifest/GenerateManifest.cs b/src/SOS/SOS.Package/GenerateManifest/GenerateManifest.cs new file mode 100644 index 0000000000..94e04b6d5b --- /dev/null +++ b/src/SOS/SOS.Package/GenerateManifest/GenerateManifest.cs @@ -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 = " "; + +const string FilesXpathInPackageElement = "Components/BinaryComponent/Files"; +const string CompressedGalleryManifestTemplate = """ + + + +"""; + +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; diff --git a/src/SOS/SOS.Package/ManifestBase.xml b/src/SOS/SOS.Package/ManifestBase.xml new file mode 100644 index 0000000000..a6dcfc8d91 --- /dev/null +++ b/src/SOS/SOS.Package/ManifestBase.xml @@ -0,0 +1,40 @@ + + + SOS + + Debugging aid for .NET Core programs and runtimes + + + + + + + + + + + + + + + + + + + + + + + + + + + + !soshelp + Displays all available SOS commands or details about the command + + + + + + diff --git a/src/SOS/SOS.Package/SOS.Package.csproj b/src/SOS/SOS.Package/SOS.Package.csproj index 5607b1c05f..b22f4f9101 100644 --- a/src/SOS/SOS.Package/SOS.Package.csproj +++ b/src/SOS/SOS.Package/SOS.Package.csproj @@ -9,7 +9,9 @@ true false tools - $(ArtifactsPackagesDir)\GalleryManifest.xml + $(MSBuildThisFileDirectory)ManifestBase.xml + $(IntermediateOutputPath)sos_GalleryManifest.xml + $(IntermediateOutputPath)GalleryManifest.xml GenerateGalleryManifest true false @@ -22,7 +24,11 @@ - + + + $(SOSPackagePathPrefix) + + $(SOSPackagePathPrefix) @@ -30,64 +36,18 @@ + - - - - - SOS - $(FileVersion) - Debugging aid for .NET Core programs and runtimes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - !soshelp - Displays all available SOS commands or details about the command - - - - - - -]]> - - - + - + + + diff --git a/src/SOS/SOS.Package/SOS.Symbol.Package.csproj b/src/SOS/SOS.Package/SOS.Symbol.Package.csproj index 1cf078ca4c..dbb9daae4b 100644 --- a/src/SOS/SOS.Package/SOS.Symbol.Package.csproj +++ b/src/SOS/SOS.Package/SOS.Symbol.Package.csproj @@ -14,6 +14,7 @@ + $(SOSPackagePathPrefix)/lib diff --git a/src/Tools/dotnet-dump/dotnet-dump.csproj b/src/Tools/dotnet-dump/dotnet-dump.csproj index 53e283c64d..991a0fadcf 100644 --- a/src/Tools/dotnet-dump/dotnet-dump.csproj +++ b/src/Tools/dotnet-dump/dotnet-dump.csproj @@ -37,6 +37,4 @@ - - diff --git a/src/Tools/dotnet-sos/dotnet-sos.csproj b/src/Tools/dotnet-sos/dotnet-sos.csproj index aed14a432f..e23c0cf963 100644 --- a/src/Tools/dotnet-sos/dotnet-sos.csproj +++ b/src/Tools/dotnet-sos/dotnet-sos.csproj @@ -29,6 +29,4 @@ PreserveNewest - - diff --git a/src/sos-packaging.props b/src/sos-packaging.props index 9312fea0bb..95e0d090ef 100644 --- a/src/sos-packaging.props +++ b/src/sos-packaging.props @@ -1,16 +1,23 @@ - $(ArtifactsBinDir)\SOS.Extensions\$(Configuration)\netstandard2.0\publish\*.dll + true + + + + + + - + @@ -20,9 +27,9 @@ - - - + + + @@ -32,14 +39,14 @@ - - - - - - - + + + + + + + @@ -51,29 +58,39 @@ - <_SosBinariesToPack Include="@(SosRequiredBinaries)" /> - - - - <_winSosRequiredBinaries Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\sos.dll" TargetRid="win-x64" /> - <_winSosRequiredBinaries Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\Microsoft.DiaSymReader.Native.amd64.dll" TargetRid="win-x64" /> - <_winSosRequiredBinaries Condition="'$(PackageWithCDac)' == 'true'" Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\mscordaccore_universal.dll" TargetRid="win-x64" /> - - - <_SosBinariesToPack Condition="'$(BuildX64Package)' == 'true'" - Include="@(_winSosRequiredBinaries)" /> - - + + $([MSBuild]::ValueOrDefault('%(FullPath)', '').Replace('linux-musl','linux')) + - + false - true + + + + + + + true $(SOSPackagePathPrefix)/%(TargetRid) - %(TargetRid)/%(Filename)%(Extension) PreserveNewest + %(TargetRid)/%(Filename)%(Extension) + %(TargetRid)/%(Filename)%(Extension) + + PreserveNewest + + + + false + false + Never + %(TargetRid)/%(Filename)%(Extension) + PreserveNewest diff --git a/src/sos-packaging.targets b/src/sos-packaging.targets deleted file mode 100644 index 18a2a56952..0000000000 --- a/src/sos-packaging.targets +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - $([MSBuild]::ValueOrDefault('%(FullPath)', '').Replace('linux-musl', 'linux')) - - - - - - \ No newline at end of file