Skip to content

[tests] Add missing jcw-gen project dependency to Java.Base-Tests#1442

Open
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers/java-base-tests-jcw-gen-projref
Open

[tests] Add missing jcw-gen project dependency to Java.Base-Tests#1442
jonathanpeppers wants to merge 1 commit into
mainfrom
jonathanpeppers/java-base-tests-jcw-gen-projref

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

Follow-up to #1418, which fixed the same issue in Hello-Java.Base.

Problem

The Java.Base-Tests project invokes jcw-gen.dll via the Java.Interop.Sdk targets (Sdk.targets#L195) but does not declare a ProjectReference to tools/jcw-gen/jcw-gen.csproj. Under parallel (-m) MSBuild scheduling this races: Java.Base-Tests's _JavaCreateJcws target can run before jcw-gen.dll has been produced, and dotnet fails with:

Could not execute because the specified command or file was not found.
  * You intended to execute a .NET program, but
    dotnet-...\bin\Release-net10.0\/jcw-gen.dll does not exist.

Observed on the Windows leg of build 1448024. Timestamps in that log show Java.Base-Tests invoked jcw-gen.dll at 15:54:26, but jcw-gen.dll wasn't produced until 15:54:42 — 16 seconds later.

Fix

Add a ReferenceOutputAssembly="false" ProjectReference so MSBuild orders jcw-gen ahead of Java.Base-Tests, matching the pattern already used by Hello-Java.Base and Java.Interop-Tests.

Java.Base-Tests is the only remaining consumer of Sdk.targets that was missing this reference.

Follow-up to 4b9ee55 which fixed the same issue in Hello-Java.Base.

The Java.Base-Tests project invokes jcw-gen.dll via the Java.Interop.Sdk
targets but did not declare a ProjectReference to tools/jcw-gen/jcw-gen.csproj.
Under parallel (-m) builds this can race: Java.Base-Tests's _JavaCreateJcws
target runs before jcw-gen.dll has been produced, and dotnet fails with:

    Could not execute because the specified command or file was not found.
    * You intended to execute a .NET program, but
      dotnet-...\bin\Release-net10.0\/jcw-gen.dll does not exist.

Observed on https://dev.azure.com/dnceng-public/public/_build/results?buildId=1448024

Add a ReferenceOutputAssembly=false ProjectReference so MSBuild orders
jcw-gen ahead of Java.Base-Tests, matching the pattern used by
Hello-Java.Base and Java.Interop-Tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 4, 2026 15:11
Copy link
Copy Markdown

Copilot AI left a comment

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 fixes a potential MSBuild parallel-build race in Java.Base-Tests by ensuring the jcw-gen tool project is built before the test project attempts to invoke jcw-gen.dll via Java.Interop.Sdk targets.

Changes:

  • Add a ProjectReference to tools/jcw-gen/jcw-gen.csproj with ReferenceOutputAssembly="false" in tests/Java.Base-Tests, matching the established pattern used by other Sdk.targets consumers (e.g., Java.Interop-Tests, Hello-Java.Base).

@jonathanpeppers jonathanpeppers added the ready-to-review This PR is ready to review/merge, thanks! label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-review This PR is ready to review/merge, thanks!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants