From a149c148a45efaa9775fea988920f68feabb451a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:15:54 +0000 Subject: [PATCH 1/3] Bump external/Java.Interop from `dba007b` to `7049364` Bumps [external/Java.Interop](https://github.com/dotnet/java-interop) from `dba007b` to `7049364`. - [Commits](https://github.com/dotnet/java-interop/compare/dba007ba535f91f522f86039395f7b2a145bc258...70493645c7d95648010a4cef948234a28744c03f) --- updated-dependencies: - dependency-name: external/Java.Interop dependency-version: 70493645c7d95648010a4cef948234a28744c03f dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- external/Java.Interop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/Java.Interop b/external/Java.Interop index dba007ba535..70493645c7d 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit dba007ba535f91f522f86039395f7b2a145bc258 +Subproject commit 70493645c7d95648010a4cef948234a28744c03f From 8c0dac32c1c2130ddcb4e97bc2408fa5259075d1 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 23 Jun 2026 09:29:10 -0500 Subject: [PATCH 2/3] [Xamarin.Android.Build.Tasks] Use CachedMavenRepository.GetArtifactFilePath Route Maven cache-path construction through the new public `CachedMavenRepository.GetArtifactFilePath(Artifact, string)` API added in dotnet/java-interop, removing the duplicated `Path.Combine` in `MavenExtensions.DownloadPayload`. The cache layout is now owned by a single source of truth, and we get the defense-in-depth path-escape assertion for free. The unused `cacheDir` parameter of `DownloadPayload` has been removed; `CachedMavenRepository` is already constructed with the same `MavenCacheDirectory` in `MavenDownload.GetRepository`, so the resolved paths are identical to the previous behavior. `Directory.CreateDirectory` was dropped because `CachedMavenRepository.GetFilePathAsync` creates the artifact directory on the write path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Tasks/MavenDownload.cs | 2 +- .../Utilities/MavenExtensions.cs | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs b/src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs index 96eced16660..f292557b9aa 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/MavenDownload.cs @@ -90,7 +90,7 @@ public async override System.Threading.Tasks.Task RunTaskAsync () var maven_override_filename = item.GetMetadataOrDefault ("ArtifactFilename", null); // Download artifact - var artifact_file = await MavenExtensions.DownloadPayload (repository, artifact, MavenCacheDirectory, maven_override_filename, Log, CancellationToken); + var artifact_file = await MavenExtensions.DownloadPayload (repository, artifact, maven_override_filename, Log, CancellationToken); if (artifact_file is null) return null; diff --git a/src/Xamarin.Android.Build.Tasks/Utilities/MavenExtensions.cs b/src/Xamarin.Android.Build.Tasks/Utilities/MavenExtensions.cs index 11a68e801fe..4abd9237a1b 100644 --- a/src/Xamarin.Android.Build.Tasks/Utilities/MavenExtensions.cs +++ b/src/Xamarin.Android.Build.Tasks/Utilities/MavenExtensions.cs @@ -130,19 +130,15 @@ public static bool TryParseJavaArtifacts (this ITaskItem task, string type, Task } // Returns artifact output path - public static async Task DownloadPayload (CachedMavenRepository repository, Artifact artifact, string cacheDir, string? mavenOverrideFilename, TaskLoggingHelper log, CancellationToken cancellationToken) + public static async Task DownloadPayload (CachedMavenRepository repository, Artifact artifact, string? mavenOverrideFilename, TaskLoggingHelper log, CancellationToken cancellationToken) { - var output_directory = Path.Combine (cacheDir, repository.Name, artifact.GroupId, artifact.Id, artifact.Version); - - Directory.CreateDirectory (output_directory); - var files_to_check = new List (); if (mavenOverrideFilename.HasValue ()) { - files_to_check.Add (Path.Combine (output_directory, mavenOverrideFilename)); + files_to_check.Add (repository.GetArtifactFilePath (artifact, mavenOverrideFilename)); } else { - files_to_check.Add (Path.Combine (output_directory, $"{artifact.Id}-{artifact.Version}.jar")); - files_to_check.Add (Path.Combine (output_directory, $"{artifact.Id}-{artifact.Version}.aar")); + files_to_check.Add (repository.GetArtifactFilePath (artifact, $"{artifact.Id}-{artifact.Version}.jar")); + files_to_check.Add (repository.GetArtifactFilePath (artifact, $"{artifact.Id}-{artifact.Version}.aar")); } // We don't need to redownload if we already have a cached copy From a217b18bf3bc9937bf4b460b4929b84a7ad6b410 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Tue, 23 Jun 2026 14:20:12 -0500 Subject: [PATCH 3/3] [Xamarin.Android.Build.Tasks] Fix POM parent inheritance in JavaDependencyVerification The new stricter `Artifact` validation in dotnet/java-interop exposed a latent bug in `MSBuildLoggingPomResolver.RegisterFromTaskItem`: it formatted `project.VersionedArtifactString` and re-parsed it via `Artifact.Parse`, which silently produced an `Artifact` with an empty `GroupId`/`Version` when the POM inherited those values from its `` element (e.g. `auto-value-annotations-1.10.4.pom`). The old parser accepted empty coordinates; the new one correctly rejects them, causing `XA4246 - Invalid artifact format: :auto-value-annotations:1.10.4`. Construct the `Artifact` directly from `project.GroupId`/`ArtifactId`/ `Version`, falling back to the parent POM's values when the project doesn't declare them, matching standard Maven POM inheritance semantics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Tasks/JavaDependencyVerification.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs b/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs index 3e9740609e7..92380901e3d 100644 --- a/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs +++ b/src/Xamarin.Android.Build.Tasks/Tasks/JavaDependencyVerification.cs @@ -272,7 +272,13 @@ public MSBuildLoggingPomResolver (TaskLoggingHelper logger) try { using (var file = File.OpenRead (filename)) { var project = Project.Load (file); - var registered_artifact = Artifact.Parse (project.VersionedArtifactString); + + // POMs may inherit GroupId/Version from a element, so fall back to + // the parent's values when the project itself doesn't declare them. (Without + // this, building an Artifact would fail validation with an empty coordinate.) + var groupId = project.GroupId.HasValue () ? project.GroupId : (project.Parent?.GroupId ?? ""); + var version = project.Version.HasValue () ? project.Version : (project.Parent?.Version ?? ""); + var registered_artifact = new Artifact (groupId, project.ArtifactId ?? "", version); // Return the registered artifact, preferring any overrides specified in the task item var final_artifact = new Artifact (