fix: report a bare platform SDK as shipping an app, not a library [patch] - #133
Merged
Merged
Conversation
…tch] ShippedVariants.FromProject mapped only the ConsoleApp, App and Tool suffixes to a non-library variant and ignored Windows/Linux/macOS/Ios, on the grounds that a platform SDK says which platform a project targets rather than what kind of thing it is. But those four SDKs set OutputType themselves, which is why DotNetService.IsExecutableProject and Winget.ProjectDetector.IsExecutableProject both treat a bare <Sdk Name="ktsu.Sdk.Windows" /> as a real executable. So a repository whose only executable marker was a platform SDK had RID zips built and attached to its GitHub release while its row in the generated org README showed a lib badge: the public profile page and the release it links to disagreed about what the repository ships. A platform suffix now contributes App when no kind suffix is present, and is still ignored when one is, so a Windows console app stays a cli rather than claiming both. The suffix list moves into SdkReferencePatterns beside the executable pattern it already feeds, so the names are stated once. Fixes #131 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vz6UYzJkBM6pdKKSPUz5vL
|
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.



Fixes #131
What was wrong
ShippedVariants.FromProjectmapped only theConsoleApp,AppandToolsuffixes to a non-library variant and explicitly ignoredWindows,Linux,macOSandIos, per the remark that "a platform SDK says which platform a project targets rather than what kind of thing it is".That is true as far as it goes, but those four SDKs also set
OutputTypethemselves — which is exactly whatSdkReferencePatternsdocuments, and why bothDotNetService.IsExecutableProjectandWinget.ProjectDetector.IsExecutableProjecttreat a bare<Sdk Name="ktsu.Sdk.Windows" />as a real executable.ShippedVariantsnever got the matching update, so a project declaring onlyktsu.Sdk+ a platform SDK was still reported aslib.For such a repository,
ReleaseServicebuilt and attached Windows RID-zip binaries to the GitHub release while the same repository's row in the generated org README showed alibbadge: the public profile page and the release it links to disagreed about what the repository ships.The change
ShippedVariant.Appwhen no kind suffix is present on the same project. A kind suffix still wins when there is one, so a console app built for Windows stayscliand does not also claimapp.SdkReferencePatternsbeside the executable pattern they already feed, and the executable pattern is composed from them, so the list is stated once rather than in two files that have drifted apart before.Androidis deliberately left out: it is inglobal.json's SDK set but has never been inSdkReferencePatterns.ExecutableSuffixes, so adding it here would make this classifier disagree withDotNetServicein the opposite direction. That is worth its own issue rather than a silent widening here.Tests
FromProject_WithAPlatformSdk_ReportsOnlyTheLibraryasserted the old behaviour and is replaced by three tests, following the per-suffix shape #126 used forIsExecutableProject:FromProject_WithOnlyAPlatformSdk_ReportsAnAppFromProject_WithAPlatformSdkBesideAKindSdk_ReportsOnlyTheKindFromProject_WithAPlatformSdkOnTheProjectAttribute_StillReportsAnApp<Project Sdk="…/version">reference formVerified by reverting only the two source files and re-running: the 5 new app-expectation cases fail (
Assert.AreEqual("app", …)againstlib) and pass again with the fix restored. The guardrail cases pass either way, as intended.Full suite: 649/649 passing. The Sonar-analyzer build (
-p:CustomBeforeMicrosoftCommonProps=.sonarlint/sonar-local.props) reports the same 7 pre-existing findings asmain, none in the changed files.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vz6UYzJkBM6pdKKSPUz5vL
Generated by Claude Code