Skip to content

ValidateJavaVersion is expensive #8369

@jeromelaban

Description

@jeromelaban

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

net 7 and later

Description

The task ValidateJavaVersion takes about 23 seconds to run for every project of a solution, even when running on a beefy machine (Standard_L16s_v3 with premium SSDs).

https://github.com/xamarin/xamarin-android/blob/4fffbf686bad5479a8ef7954d7d9d0d68941f034/src/Xamarin.Android.Build.Tasks/Tasks/ValidateJavaVersion.cs#L14

Interestingly, the caching mechanism here does seem to work, but not in a meaningful way:

https://github.com/xamarin/xamarin-android/blob/4fffbf686bad5479a8ef7954d7d9d0d68941f034/src/Xamarin.Android.Build.Tasks/Tasks/ValidateJavaVersion.cs#L104

Steps to Reproduce

Build any android library and observe the task takes a long time to run. In a large solution, this accounts for about 4 minutes of build time.

image

image

Did you find any workaround?

None at this time.
image

Relevant log output

No response

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.need-attentionA xamarin-android contributor needs to review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions