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

Unnecessary dependencies from coverage collection #8355

Closed
meisterT opened this issue May 16, 2019 · 1 comment
Closed

Unnecessary dependencies from coverage collection #8355

meisterT opened this issue May 16, 2019 · 1 comment
Assignees
Labels
team-Rules-Java Issues for Java rules

Comments

@meisterT
Copy link
Member

This is split out from #6656 (comment)

Every sh_test depends on the Java and C++ toolchains because of coverage.
Example:

sh_test(
    name = "foo",
    srcs = ["foo.sh"],
)

While fixing #5331 the lcov merger was added to every sh_test in 8fcc07a

This pulls in a lot of unnecessary deps, see

bazel query  --implicit_deps  'deps(@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main,1)'

@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:Main
@bazel_tools//tools/test/CoverageOutputGenerator/java/com/google/devtools/coverageoutputgenerator:all_lcov_merger_lib
@bazel_tools//tools/launcher:launcher
@bazel_tools//tools/jdk:current_java_toolchain
@bazel_tools//tools/jdk:current_java_runtime
@bazel_tools//tools/jdk:current_host_java_runtime
@bazel_tools//tools/jdk:JacocoCoverageRunner
@bazel_tools//tools/cpp:toolchain
@bazel_tools//tools/cpp:grep-includes

That also means you have to install or download the JDK via the external repository to run any sh_test. We should make this conditional.

I have no clue why this depends on the cpp:toolchain, cc @hlopko.

@meisterT meisterT added the team-Rules-Java Issues for Java rules label May 16, 2019
@hlopko hlopko changed the title unnecessary dependencies from coverage collection Unnecessary dependencies from coverage collection May 16, 2019
@iirina
Copy link
Contributor

iirina commented May 28, 2019

We can add the CoverageOutputGenerator dependency only in coverage mode.

That also means you have to install or download the JDK via the external repository to run any sh_test. We should make this conditional.

I'm not sure it means that. Bazel will try and download the host JDK because of the Java dependency, but the sh_test doesn't require an installed JDK if it's not executing any java target.

irengrig pushed a commit to irengrig/bazel that referenced this issue Jun 18, 2019
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-Java Issues for Java rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants