Skip to content

[build] Recommend latest supported JDK in workload metadata - #12500

Merged
jonathanpeppers merged 3 commits into
mainfrom
redth-recommend-jdk-21
Aug 27, 2026
Merged

jonathanpeppers merged 3 commits into
mainfrom
redth-recommend-jdk-21

Conversation

@Redth

@Redth Redth commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • select jdk.recommendedVersion from the newest non-preview, non-obsolete JDK in the Android installer feed within the workload's supported JDK range
  • carry the normalized Version used for revision ordering into range filtering while preserving the original feed revision string for output
  • continue accepting single-component feed revisions such as revision="21"
  • preserve the existing compatibility range while allowing installer feed refreshes to advance the recommended Microsoft OpenJDK release

For the current stable inputs, this changes recommendedVersion from 17.0.14 to 21.0.9 while leaving version at [17.0,22.0). This prevents setup tools that honor recommendedVersion from proposing JDK 17 when JDK 21 is supported and preferred.

Testing

  • dotnet build tools/workload-dependencies/workload-dependencies.csproj -p:DotNetStableTargetFramework=net10.0 -p:MonoOptionsVersion=6.12.0.148 -p:NewtonsoftJsonPackageVersion=13.0.3 --no-restore --nologo
  • generated stable workload metadata with JavaSdkVersion=17.0.14 and LatestSupportedJavaVersion=21.0.99; verified version: "[17.0,22.0)" and recommendedVersion: "21.0.9"
  • ran GenerateWorkloadDependencies through tools/workload-dependencies/WorkloadDependencies.proj; verified packaged data/WorkloadDependencies.json contains the expected JDK metadata
  • generated with a JDK 17 maximum and verified the range filter retains recommendedVersion: "17.0.14"

Select the newest non-preview JDK from the installer feed within the workload's supported range instead of reusing the build JDK version.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4b3f9f46-be20-4288-af69-a4f32ef172a1
Copilot AI lite review requested due to automatic review settings August 25, 2026 00:17

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.

Pull request overview

Updates workload metadata to recommend the newest supported, non-preview JDK release while preserving the compatibility range.

Changes:

  • Filters JDK revisions to the supported range.
  • Selects the latest eligible release.
  • Preserves the existing compatibility range.

Comment thread tools/workload-dependencies/Program.cs Resolved
@jonathanpeppers

Copy link
Copy Markdown
Member

I don't think we even support the 17, where is the 17 coming from?

See also:

So, we might recommend 21 in .NET 11 and allow up to 25 -- still need to get it working, though.

@Redth

Redth commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

I traced the 17 in the published stable manifest. It is not coming from the current main support policy; it comes from a stale installer default embedded in the 36.1.69 SDK pack.

Specifically, Microsoft.Android.Sdk.* 36.1.69 contains:

  • tools/Xamarin.Installer.Common.props: JavaSdkVersion=17.0.14
  • tools/Xamarin.Android.Common.props: JavaSdkVersion=21.0.8, MinimumSupportedJavaVersion=17.0, LatestSupportedJavaVersion=21.0.99

WorkloadDependencies.proj imports Xamarin.Installer.Common.props first. Since both JavaSdkVersion assignments are conditional, 17.0.14 wins. It is then passed as --jdk-version=$(JavaSdkVersion), and the old generator uses that value both as the range floor and as recommendedVersion. LatestSupportedJavaVersion=21.0.99 supplies the ceiling, producing exactly:

{
  "version": "[17.0,22.0)",
  "recommendedVersion": "17.0.14"
}

The NuGet package identifies source commit d549e1dc4e2a083b08b4f24cb5495e81b99d79b5, and I verified these values directly in the published Microsoft.NET.Sdk.Android.Manifest-10.0.100 and Microsoft.Android.Sdk.Darwin 36.1.69 packages.

Current main already has JavaSdkVersion=21.0.8 in Xamarin.Installer.Common.props. With #12478 establishing the .NET 11 support range as JDK 21 through 25, I agree we should not preserve 17 for the .NET 11 manifest. This PR is fixing the separate coupling that made the build/default JDK automatically become the recommendation.

@jonathanpeppers

Copy link
Copy Markdown
Member

/review

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Android PR Reviewer completed successfully!

Generated by Android PR Reviewer for #12500

@github-actions github-actions Bot 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.

❌ Reject

Findings: 1 error, 0 warnings, 0 suggestions.

The supported-range selection fixes the stale JDK recommendation and all 45 reported checks are green. However, the new filter bypasses existing revision normalization and can fail on a previously accepted feed value; address the inline finding before merge.

Generated by Android PR Reviewer for #12500 · gpt56 · 97.8 AIC · ⌖ 8.79 AIC · ⊞ 25.7K
Comment /review to run again

Comment thread tools/workload-dependencies/Program.cs Resolved
jonathanpeppers and others added 2 commits August 26, 2026 16:04
Carry the normalized Version through revision selection so single-component feed revisions remain supported, and add CI regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the dedicated test project and CI wiring while retaining the normalized revision fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 70004bfe-9b49-444e-b9be-f15d14383473
@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable). label Aug 27, 2026
@jonathanpeppers
jonathanpeppers merged commit de313e3 into main Aug 27, 2026
44 checks passed
@jonathanpeppers
jonathanpeppers deleted the redth-recommend-jdk-21 branch August 27, 2026 18:43
@jonathanpeppers

Copy link
Copy Markdown
Member

/backport to release/10.0.1xx

@github-actions

Copy link
Copy Markdown
Contributor

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

jonathanpeppers added a commit that referenced this pull request Aug 28, 2026
…12543)

## Summary

- select `jdk.recommendedVersion` from the newest non-preview, non-obsolete JDK in the Android installer feed within the workload's supported JDK range
- carry the normalized `Version` used for revision ordering into range filtering while preserving the original feed revision string for output
- continue accepting single-component feed revisions such as `revision="21"`
- preserve the existing compatibility range while allowing installer feed refreshes to advance the recommended Microsoft OpenJDK release

For the current stable inputs, this changes `recommendedVersion` from `17.0.14` to `21.0.9` while leaving `version` at `[17.0,22.0)`. This prevents setup tools that honor `recommendedVersion` from proposing JDK 17 when JDK 21 is supported and preferred.

## Testing

- `dotnet build tools/workload-dependencies/workload-dependencies.csproj -p:DotNetStableTargetFramework=net10.0 -p:MonoOptionsVersion=6.12.0.148 -p:NewtonsoftJsonPackageVersion=13.0.3 --no-restore --nologo`
- generated stable workload metadata with `JavaSdkVersion=17.0.14` and `LatestSupportedJavaVersion=21.0.99`; verified `version: "[17.0,22.0)"` and `recommendedVersion: "21.0.9"`
- ran `GenerateWorkloadDependencies` through `tools/workload-dependencies/WorkloadDependencies.proj`; verified packaged `data/WorkloadDependencies.json` contains the expected JDK metadata
- generated with a JDK 17 maximum and verified the range filter retains `recommendedVersion: "17.0.14"`

Co-authored-by: Jonathan Dick <jondick@gmail.com>
Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ready-to-review This PR is ready to review/merge, I think any CI failures are just flaky (ignorable).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants