Skip to content

Fix Java coverage support on Windows by adding coverage_main_class to launch_info#311

Closed
KrishnaM256 wants to merge 2 commits into
bazelbuild:masterfrom
KrishnaM256:master
Closed

Fix Java coverage support on Windows by adding coverage_main_class to launch_info#311
KrishnaM256 wants to merge 2 commits into
bazelbuild:masterfrom
KrishnaM256:master

Conversation

@KrishnaM256

Copy link
Copy Markdown
Contributor

Summary

This PR enables Java code coverage to work properly on Windows by adding the coverage_main_class to the launch_info metadata in bazel_java_binary.bzl. Without this addition, Bazel fails to properly instrument and run Java binaries with coverage enabled on Windows platforms.

Changes

  • Added coverage_main_class to launch_info in bazel_java_binary.bzl to explicitly define the main class used during coverage runs.

Motivation

  • Before this fix, attempts to run Java coverage tests on Windows would not produce proper coverage output.
  • This is a step toward resolving bazelbuild/bazel#18839.

@KrishnaM256 KrishnaM256 requested review from a team and comius as code owners August 6, 2025 09:39

@fmeum fmeum 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.

Comment thread java/bazel/rules/bazel_java_binary.bzl Outdated
@copybara-service copybara-service Bot closed this in 45061b3 Aug 7, 2025
@KrishnaM256

Copy link
Copy Markdown
Contributor Author

Hi! I’d like to kindly request a new release of rules_java that includes this fix, as we’re depending on it to enable Java code coverage on Windows in Bazel.
A tagged release would help us integrate the fix cleanly.

copybara-service Bot pushed a commit that referenced this pull request Aug 7, 2025
Context: #311 (comment)

(ignore-relnotes)

PiperOrigin-RevId: 792147204
Change-Id: Ic881922527848bf51e785cf6d275eebcbe55ab7f
@hvadehra

hvadehra commented Aug 7, 2025

Copy link
Copy Markdown
Member

https://github.com/bazelbuild/rules_java/releases/tag/8.15.1

@KrishnaM256

Copy link
Copy Markdown
Contributor Author

https://github.com/bazelbuild/rules_java/releases/tag/8.15.1

Thank you! Appreciate the quick release 🙌

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.

3 participants