Support repository layouts beyond src/packages in SBOM generation - #5
Merged
Conversation
Xpf-style repositories keep their packing projects under fork/ and tools/, restore Arcade projects into artifacts/obj/<Project>/, and ship first-party binaries whose names match no project (wpfgfx_xpf). Adds optional GenerateForPackage parameters for the project search directories, extra first-party binary names, and a -biop pass-through to cyclonedx-dotnet, plus a public ReadPackageVersion helper for repos whose versions are computed by MSBuild. Defaults are unchanged for existing consumers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the shared SbomGenerator to support repositories whose constituent projects and restore artifacts don’t follow the existing src/** + packages/** assumptions, while keeping defaults unchanged for current component-repo consumers.
Changes:
- Added optional
projectSearchDirs,additionalProductNames, andbaseIntermediateOutputPathparameters toGenerateForPackageto support non-standard repo layouts and Arcade-style restore layouts. - Updated package-content verification to accept an expanded set of “first-party” binary names (constituent project IDs + optional additional names).
- Added
ReadPackageVersionhelper for callers that need to read the shipped package version from the.nuspec.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
kekekeks
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #4: extends
SbomGeneratorso Xpf (and any repository with a non-src/packageslayout) can reuse the shared CycloneDX SBOM generation. Defaults are unchanged for the existing component-repository consumers.What changed
projectSearchDirsparameter onGenerateForPackage— Xpf keeps its packing projects underfork/packaging/, its SDK task project undertools/, and its winforms fork underfork/winforms/, none of which the hardcodedsrc/**+packages/**globs covered.additionalProductNamesparameter — names of first-party binaries that match no constituent project id and noAvalonia.*/AvaloniaUI.*prefix (e.g. Xpf'"'"'s nativewpfgfx_xpf.dll, orSystem.Printing.dllwhich ships from theSystem.Printing-refproject), so the package-content scan records them as manufacturer-supplied with hashes instead of flagging them as unaccounted third-party binaries.baseIntermediateOutputPathparameter — forwarded to cyclonedx-dotnet as-biopfor Arcade-style repositories that restore intoartifacts/obj/<Project>/project.assets.json. Projects not found there still resolve through cyclonedx-dotnet'"'"'s msbuildProjectAssetsFileevaluation fallback, so mixed-layout repositories (Xpf'"'"'sfork/packagingprojects use plain<projectDir>/obj) work with a single setting. Passed as a separate literal argument string becauseTool'"'"'s argument handler re-quotes interpolated values — a pre-built" -biop ..."fragment gets mangled into the preceding-svvalue.ReadPackageVersionhelper — public counterpart toReadPackageIdfor repositories that callGenerateForPackagedirectly but whose package versions are computed by MSBuild.Known limitation (pre-existing, follow-up candidate)
Multi-RID native binaries (e.g.
runtimes/{win-x64,win-x86,...}/native/foo.dll) share one assembly name and version, so the package-content scan dedupes them into a single component and only the first RID'"'"'s SHA-512 is recorded. Recording one hashed component per shipped file (keyed by package path) would be stronger CRA evidence; left out of this PR to keep existing consumers'"'"' SBOMs stable.Test plan
NukeExtensions.csprojbuilds warning-free against Nuke.Common 9.0.4Xpfwith 31 constituent projects,Xpf.Sdk,AvaloniaUI.Xpf.WinApiShim,AvaloniaUI.Xpf.WindowsFormsShim) against real packed output with zero warnings — every constituent located, no unaccounted binaries,wpfgfx_xpfrecorded as first-party with SHA-512, nuspec-only dependencies re-added, embedded_manifest/cyclonedx/bom.cdx.jsonbyte-identical to the standalone copy withjsonregistered in[Content_Types].xml🤖 Generated with Claude Code