[dotnet] include .snupkg in nuget_push runfiles so symbols get published#17471
[dotnet] include .snupkg in nuget_push runfiles so symbols get published#17471titusfortner wants to merge 1 commit into
Conversation
Review Summary by QodoInclude .snupkg symbol packages in nuget_push runfiles
WalkthroughsDescription• Include .snupkg symbol packages in nuget_push runfiles • Filter out .snupkg files from push commands to avoid duplicate uploads • Allow dotnet nuget push to auto-detect and upload symbols • Enables proper symbol package publishing alongside main packages Diagramflowchart LR
A["nuget_pack produces .nupkg and .snupkg"] -->|"allow_files updated"| B["Both files included in runfiles"]
B -->|"Unix/Windows script filters"| C["Only .nupkg files get push commands"]
C -->|"dotnet nuget push auto-detection"| D["Symbols uploaded alongside package"]
File Changes1. dotnet/private/nuget_push.bzl
|
Code Review by Qodo
1. Silent no-op push
|
There was a problem hiding this comment.
Pull request overview
Allows .snupkg symbol packages into the nuget_push rule's runfiles so that dotnet nuget push auto-detects and uploads them alongside their .nupkg siblings, while skipping explicit push commands for .snupkg files.
Changes:
- Expand
allow_fileson thepackagesattribute to include.snupkg. - Skip non-
.nupkgfiles when generating push commands in both Unix and Windows script generators.
| if not nupkg.basename.endswith(".nupkg"): | ||
| continue |
There was a problem hiding this comment.
1. Silent no-op push 🐞 Bug ≡ Correctness
nuget_push now permits .snupkg inputs but the generated scripts skip any package that is not a .nupkg; if a caller passes only .snupkg files, the script will have no push commands and will exit successfully without publishing anything.
Agent Prompt
### Issue description
`nuget_push` accepts `.snupkg` files (via `allow_files`) but both Unix and Windows script generators skip non-`.nupkg` entries. If the input list contains only `.snupkg`, the script ends up with an empty command list and exits successfully, causing a silent “published nothing” failure.
### Issue Context
This PR intentionally filters `.snupkg` out of the push commands and relies on `dotnet nuget push <pkg>.nupkg` to auto-detect and upload `<pkg>.snupkg` if present in the same directory.
### Fix Focus Areas
- dotnet/private/nuget_push.bzl[37-47]
- dotnet/private/nuget_push.bzl[78-89]
### Suggested fix
- After filtering `nupkg_files` down to `.nupkg` entries, **fail loudly** if the resulting list is empty (e.g., `fail("nuget_push: no .nupkg files provided")`).
- (Optional) Use `nupkg.extension == "nupkg"` instead of `basename.endswith(".nupkg")` for clarity.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
I think #17467 should be used instead of this PR |
|
|
When I was looking at SourceLink things, the Agent said we were releasing wrong for the new snupkg (or at least not ideally). This is the suggested fix. @nvborisenko can you verify?
💥 What does this PR do?
nuget_pack produces both a .nupkg (main package) and a .snupkg (symbol/debug package) per target. Previously, allow_files = [".nupkg"] filtered the .snupkg out when nuget_push collected files via ctx.files.packages. That meant the symbol package never made it into nupkg_files, and therefore never made it into the runfiles tree built on line 16 (ctx.runfiles(files = nupkg_files + [dotnet])).
snupkg is now in the iteration list (because of change #1), but we don't want a separate push command for it. We let dotnet nuget push handle symbols via its built-in auto-detection
dotnet nuget push foo.nupkg automatically looks for foo.snupkg in the same directory and uploads it as the symbol package. nuget_pack declares both files with the same stem (e.g. Selenium.WebDriver.4.27.0.nupkg and Selenium.WebDriver.4.27.0.snupkg), so once the .snupkg is in runfiles, it lands right next to its .nupkg and dotnet finds it on its own.
🤖 AI assistance