From dd008cdef514dc98f9f70b055821cd95f16ebe76 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Thu, 21 May 2026 14:49:04 -0500 Subject: [PATCH 1/3] [build] provision OpenJDK before Java.Interop Prepare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `PrepareJavaInterop` target invokes Java.Interop's `Prepare` target with `-p:JdksRoot=$(JavaSdkDirectory)`, but nothing in the `make prepare` flow has actually downloaded and extracted the Microsoft OpenJDK into that directory yet. The JDK is only provisioned later by `src/openjdk/openjdk.csproj` during `make all`. As a result, Java.Interop's `JdkInfo` task logs: warning : Could not get information about JdksRoot path `/Users/runner/android-toolchain/jdk-21`: Not a directory …and falls back to scanning system-installed JDKs. On the macOS hosted images this now picks up the preinstalled Temurin JDK 25, which is written into `JdkInfo.props` as `\$(JavaSdkDirectory)\`. Later in the build, `gradlew` is invoked with `JAVA_HOME=\$(JavaSdkDirectory)\`` and Gradle 8.12 starts its daemon on JDK 25 — which it does not support — producing: FAILURE: Build failed with an exception. > Could not create task ':test'. > Could not create an instance of type org.gradle.api.reporting.internal.DefaultReportContainer. > Type T not present BUILD FAILED Fix this by adding a `PrepareOpenJDK` target that builds `src/openjdk/openjdk.csproj` before `PrepareJavaInterop` runs, so the JDK we provision is already present on disk when Java.Interop's `JdkInfo` task evaluates `JdksRoot`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/DotNet.targets | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build-tools/scripts/DotNet.targets b/build-tools/scripts/DotNet.targets index 10885cd529d..762ceb34964 100644 --- a/build-tools/scripts/DotNet.targets +++ b/build-tools/scripts/DotNet.targets @@ -16,7 +16,18 @@ /> - + + + + + + Date: Thu, 21 May 2026 15:21:05 -0500 Subject: [PATCH 2/3] Use task instead of for openjdk.csproj Avoids backslash-escaping issues when /bin/sh -c invokes the Exec command on macOS/Linux, and matches how BuildDotNet already invokes xa-prep-tasks.csproj and Xamarin.Android.sln. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/DotNet.targets | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build-tools/scripts/DotNet.targets b/build-tools/scripts/DotNet.targets index 762ceb34964..92b8afbac37 100644 --- a/build-tools/scripts/DotNet.targets +++ b/build-tools/scripts/DotNet.targets @@ -21,9 +21,7 @@ before Java.Interop's Prepare target scans for a JDK. Otherwise its JdkInfo task falls back to a system-installed JDK (e.g. the JDK 25 preinstalled on hosted macOS images), which can be incompatible with our Gradle version. --> - + Date: Thu, 21 May 2026 16:07:34 -0500 Subject: [PATCH 3/3] Restore openjdk.csproj before building it The task does not auto-restore, so building openjdk.csproj without a prior restore fails with NETSDK1004 on agents that have not yet restored the solution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- build-tools/scripts/DotNet.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/scripts/DotNet.targets b/build-tools/scripts/DotNet.targets index 92b8afbac37..173cfda700a 100644 --- a/build-tools/scripts/DotNet.targets +++ b/build-tools/scripts/DotNet.targets @@ -21,7 +21,7 @@ before Java.Interop's Prepare target scans for a JDK. Otherwise its JdkInfo task falls back to a system-installed JDK (e.g. the JDK 25 preinstalled on hosted macOS images), which can be incompatible with our Gradle version. --> - +