Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new coverage collection method for Java #7124

Closed
iirina opened this issue Jan 15, 2019 · 1 comment
Closed

Use the new coverage collection method for Java #7124

iirina opened this issue Jan 15, 2019 · 1 comment
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules

Comments

@iirina
Copy link
Contributor

iirina commented Jan 15, 2019

There is a new coverage collection method for Java available for over a year. Currently it can be enabled by using --experimental_java_coverage. Make this method the default.

What the new method does differently:

  • makes possible collecting coverage for Starlark JVM languages and jars imported with java_import
  • only includes JVM files in the coverage report (dismisses data files, for example .js files that shouldn't have been in the report in the first place)
  • the report includes the actual path of the files relative to the workspace root instead of the package path (e.g. src/com/google/Action.java instead of com/google/Action.java). This allows genhtml to generate HTML reports from the combined bazel coverage output.

For more details see Bazel coverage for JVM languages.

The change will be done with an incompatible flag --incompatible_java_coverage, because it changes the file paths in the report (the coverage output).

The users do not have to do any migration. Having the package paths in the report was filed as a bug (see #2528).

@iirina iirina added the team-Rules-Java Issues for Java rules label Jan 15, 2019
@iirina iirina self-assigned this Jan 15, 2019
@iirina iirina added the P2 We'll consider working on this in future. (Assignee optional) label Jan 15, 2019
bazel-io pushed a commit that referenced this issue Jan 15, 2019
so we can use the new tested java coverage method in Bazel.

See #7124.

RELNOTES:
PiperOrigin-RevId: 229333194
bazel-io pushed a commit that referenced this issue Feb 20, 2019
…test.

1) to enable coverage for executing a java binary (see 68c7e5a)
2) to collect uninstrumented class files from the system classpath in the JacocoCoverageRunner before starting the actual test.

Progress on #7124.

RELNOTES: None.
PiperOrigin-RevId: 234763346
bazel-io pushed a commit that referenced this issue Feb 21, 2019
The merged jar was used by JacocoCoverageRunner to collect coverage. Since unknown commit JacocoCoverageRunner gets the runtime classpath from the system classloader, so there is no more need for the merged jar.

Progress on #7124.

RELNOTES: None.
PiperOrigin-RevId: 234988946
bazel-io pushed a commit that referenced this issue Feb 22, 2019
*** Reason for rollback ***

Breaks guitar, b/125764428

*** Original change description ***

Stop creating a merged jar in an action in java binary.

The merged jar was used by JacocoCoverageRunner to collect coverage. Since unknown commit JacocoCoverageRunner gets the runtime classpath from the system classloader, so there is no more need for the merged jar.

Progress on #7124.

RELNOTES: None.
PiperOrigin-RevId: 235207828
@iirina
Copy link
Contributor Author

iirina commented Feb 28, 2019

This was enabled in e64066d.

@iirina iirina closed this as completed Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-Java Issues for Java rules
Projects
None yet
Development

No branches or pull requests

1 participant