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

cc_test rules trigger remote JDK download (~200 MB) #15088

Closed
junyer opened this issue Mar 21, 2022 · 2 comments
Closed

cc_test rules trigger remote JDK download (~200 MB) #15088

junyer opened this issue Mar 21, 2022 · 2 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: bug

Comments

@junyer
Copy link

junyer commented Mar 21, 2022

Description of the problem / feature request:

cc_test rules trigger remote JDK download (~200 MB), which is undesirable when operating under constraints on storage capacity and/or network capacity. https://en.wikipedia.org/wiki/Principle_of_least_astonishment also applies.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ rm -rf $HOME/.cache/bazel
$ git clone https://github.com/google/re2.git
$ cd re2
$ bazel build //:all --experimental_repository_resolved_file=resolved.bzl
$ grep openjdk resolved.bzl
$ bazel query 'somepath(//:all, @remote_coverage_tools//:all)'

What operating system are you running Bazel on?

Linux

What's the output of bazel info release?

release 5.0.0
@Wyverald
Copy link
Member

cc @comius @c-mita

@meteorcloudy
Copy link
Member

It's seems the issue is that cc_tests unconditionally pulls those coverage tools dependencies.
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/analysis/test/TestConfiguration.java;l=255-270

@meteorcloudy meteorcloudy added type: bug P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules labels Mar 21, 2022
hvadehra pushed a commit that referenced this issue Feb 14, 2023
Before this change, every test rule had an implicit dependency on `@bazel_tools//tools/test:coverage_report_generator`, even though this tool is only used when collecting coverage.

This is fixed by moving it to `CoverageOptions` and using the late-bound default resolver to only create a dependency if coverage is enabled.

Also adds `CoverageOptions` to the set of options classes trimmed by `--trim_test_configuration` so that, as before, changing `--coverage_report_generator` doesn't cause non-test rules to be reanalyzed. This behavior now extends to `--coverage_output_generator`.

Fixes #15088

Closes #16995.

PiperOrigin-RevId: 498949871
Change-Id: I2440fae2655bbb701e918ee2aa7acb008d8f97ed
fmeum added a commit to fmeum/bazel that referenced this issue Feb 16, 2023
Before this change, every test rule had an implicit dependency on `@bazel_tools//tools/test:coverage_report_generator`, even though this tool is only used when collecting coverage.

This is fixed by moving it to `CoverageOptions` and using the late-bound default resolver to only create a dependency if coverage is enabled.

Also adds `CoverageOptions` to the set of options classes trimmed by `--trim_test_configuration` so that, as before, changing `--coverage_report_generator` doesn't cause non-test rules to be reanalyzed. This behavior now extends to `--coverage_output_generator`.

Fixes bazelbuild#15088

Closes bazelbuild#16995.

PiperOrigin-RevId: 498949871
Change-Id: I2440fae2655bbb701e918ee2aa7acb008d8f97ed
keertk added a commit that referenced this issue Feb 19, 2023
Before this change, every test rule had an implicit dependency on `@bazel_tools//tools/test:coverage_report_generator`, even though this tool is only used when collecting coverage.

This is fixed by moving it to `CoverageOptions` and using the late-bound default resolver to only create a dependency if coverage is enabled.

Also adds `CoverageOptions` to the set of options classes trimmed by `--trim_test_configuration` so that, as before, changing `--coverage_report_generator` doesn't cause non-test rules to be reanalyzed. This behavior now extends to `--coverage_output_generator`.

Fixes #15088

Closes #16995.

PiperOrigin-RevId: 498949871
Change-Id: I2440fae2655bbb701e918ee2aa7acb008d8f97ed

Co-authored-by: kshyanashree <[email protected]>
Co-authored-by: keertk <[email protected]>
keertk added a commit that referenced this issue Feb 19, 2023
…7287)

* Only fetch @remote_coverage_tools when collecting coverage

Before this change, every test rule had an implicit dependency on `@bazel_tools//tools/test:coverage_report_generator`, even though this tool is only used when collecting coverage.

This is fixed by moving it to `CoverageOptions` and using the late-bound default resolver to only create a dependency if coverage is enabled.

Also adds `CoverageOptions` to the set of options classes trimmed by `--trim_test_configuration` so that, as before, changing `--coverage_report_generator` doesn't cause non-test rules to be reanalyzed. This behavior now extends to `--coverage_output_generator`.

Fixes #15088

Closes #16995.

PiperOrigin-RevId: 498949871
Change-Id: I2440fae2655bbb701e918ee2aa7acb008d8f97ed

* Update BUILD

---------

Co-authored-by: Fabian Meumertzheim <[email protected]>
Co-authored-by: keertk <[email protected]>
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-CPP Issues for C++ rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants