Skip to content

Unnecessary dependencies from coverage collection #8355

@meisterT

Description

@meisterT

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions