Natan
Natan

Reputation: 2054

Running bazel build with an aspect on test targets does not yield test output jars

running bazel build //... \ --aspects some-aspect.bzl%some_aspect \ --output_groups=some_new_output,default does not create test jars outputs.

on the other hand running bazel test does create the test jar outputs:

bazel test //... \ --aspects some-aspect.bzl%some_aspect \ --output_groups=some_new_output,default

How come?

This question was updated to reflect use of aspects: The original question:

running bazel build //... does not add test code to output jar.

on the other hand bazel test //... builds the test code but also runs it.

Is there a way in bazel to build the test code without running the tests?

Upvotes: 2

Views: 795

Answers (2)

Natan
Natan

Reputation: 2054

I had a mistake in the values I gave the --output_groups flag.

It should have been --output_groups=+some_new_output,+default

The default can even be omitted:

--output_groups=+some_new_output

This flag is not documented at all. There is an open issue on this in bazel github repo.

Upvotes: 2

László
László

Reputation: 4271

You may be looking for --build_tests_only.

Upvotes: 0

Related Questions