Skip to content

[tests] Isolate parallel Kotlin Gradle state#12217

Open
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-fix-java-interop-ci
Open

[tests] Isolate parallel Kotlin Gradle state#12217
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers-fix-java-interop-ci

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

Description

Java.Interop solution builds run the Kotlin fixture from two test projects in parallel. Although their Gradle user homes and class outputs were already separate, they still shared the fixture's mutable Gradle build directory and project cache. This intermittently corrupted Kotlin compiler snapshots on Windows and plugin configuration state on macOS.

Keep each invocation's build directory and Gradle project cache under the importing project's obj directory. This fully isolates parallel builds while preserving the existing direct-Gradle defaults.

Testing

dotnet build external\Java.Interop\Java.Interop.sln -c Release with the local JDK tool properties configured. Both Kotlin Gradle invocations completed concurrently.

Keep each importing Java.Interop test project build directory and Gradle project cache under its own obj directory so parallel solution builds cannot corrupt compiler snapshots or plugin configuration state.

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

Copilot-Session: 0798499d-b183-4bbe-b627-d404fa5a5455
Copilot AI review requested due to automatic review settings July 23, 2026 20:36

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

This PR addresses intermittent failures when the Kotlin/Gradle test fixture is built concurrently by multiple Java.Interop test projects, by isolating remaining shared Gradle mutable state (build directory + project cache) per importing project under obj/.

Changes:

  • Configure the Kotlin Gradle fixture to honor an externally supplied build directory via kotlinBuildDir.
  • Update the MSBuild Exec invocation to pass per-project --project-cache-dir and -PkotlinBuildDir=... paths under each project’s intermediate output directory.
  • Expand the target documentation to explain why build + project cache isolation is required in addition to GRADLE_USER_HOME.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
external/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/kotlin-gradle/build.gradle.kts Sets Gradle build output location from an MSBuild-provided property to avoid shared build state.
external/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/kotlin-gradle.targets Routes Gradle project cache + build directories into each project’s obj/ to fully isolate parallel builds.

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.

2 participants