Skip to content

[build] Skip empty preview platform in WorkloadDependencies.json - #13557

Merged
jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-fix-empty-preview-platform
Nov 16, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
jonathanpeppers-fix-empty-preview-platform

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Context: dotnet/dotnet#10985 (comment)

On release/11.0.1xx, API 37 is now stable, so no AndroidBuildApiLevel has Unstable=true and AndroidPreviewPlatformIds is empty. In WorkloadDependencies.proj, the argument --preview-platform-version=%(_AndroidPreviewPlatformId.Identity) uses batching. When the item list is empty, MSBuild still makes one bucket with an empty value, so the tool gets --preview-platform-version=. The tool then writes this optional entry:

{
  "desc": "Android SDK Platform  (Preview)",
  "sdkPackage": { "id": "platforms;android-" },
  "optional": "true"
}

platforms;android- is not an installable Android SDK package.

Changes:

  • WorkloadDependencies.proj: add a condition, so no argument is made for an empty value.
  • Program.cs: ignore empty --preview-platform-version values.

After this merges, it must also be backported to release/11.0.1xx.

Testing:

  • MSBuild repro of the item pattern: an empty list now makes no argument; A,B makes two arguments.
  • dotnet run --project tools/workload-dependencies/workload-dependencies.csproj ... --platform-version=android-37.0 --preview-platform-version=: output has only platforms;android-37.0.
  • The same command with --preview-platform-version=CinnamonBun: output still has the platforms;android-CinnamonBun preview entry.
  • No full SDK build was run.

When no AndroidBuildApiLevel is Unstable (for example after GA),
MSBuild batching over the empty _AndroidPreviewPlatformId item list
still made one --preview-platform-version= argument with no value.
The tool then wrote an optional platforms;android- entry, which is
not an installable Android SDK package.

Add a condition to the item so no argument is made for empty values,
and make the tool ignore empty --preview-platform-version values.

Context: dotnet/dotnet#10985 (comment)

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the change to omit blank Android preview-platform dependencies.

No open issues 🎉

What changed in this PR

Prevents the workload dependency generator from emitting an invalid platforms;android- package entry when no preview Android platform is configured.

Changes:

  • Omit the preview-platform argument in MSBuild when its item value is empty.
  • Ignore empty or whitespace-only preview-platform values in the command-line parser, while preserving valid previews.
File Description
tools/​workload-dependencies/​WorkloadDependencies.proj Guards preview argument generation against empty item values.
tools/​workload-dependencies/​Program.cs Filters blank preview versions before adding them to the dependency list.

Review effort: Balanced

@jonathanpeppers
jonathanpeppers merged commit 633d75a into main Nov 16, 2026
41 checks passed
@jonathanpeppers
jonathanpeppers deleted the jonathanpeppers-fix-empty-preview-platform branch November 16, 2026 16:08
@jonathanpeppers

Copy link
Copy Markdown
Member Author

/backport to release/11.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0.1xx (link to workflow run)

jonathanpeppers added a commit that referenced this pull request Nov 17, 2026
…13557) (#13575)

When no AndroidBuildApiLevel is Unstable (for example after GA),
MSBuild batching over the empty _AndroidPreviewPlatformId item list
still made one --preview-platform-version= argument with no value.
The tool then wrote an optional platforms;android- entry, which is
not an installable Android SDK package.

Add a condition to the item so no argument is made for empty values,
and make the tool ignore empty --preview-platform-version values.

Context: dotnet/dotnet#10985 (comment)

Co-authored-by: Jonathan Peppers <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants