bazel icon indicating copy to clipboard operation
bazel copied to clipboard

bazel should not build/test targets inside output_base if output_base is in source tree

Open peakschris opened this issue 1 year ago • 1 comments

Description of the bug:

When we build/test with bazel in CI, we run with this command:

bazel --output_base=output test //...

However, if any external deps contain test targets, these are picked up by the build, evaluated in the context of outer workspace, and fail.

ERROR: Skipping '//...': error loading package under directory '': error loading package 'output/external/our_rules~/tests/lib/libb': cannot load '//:tools/defs.bzl': no such file

The question is: should the directory that bazel creates with --output_base be automatically ignored in build/test steps if it's inside the workspace?

Which category does this issue belong to?

Core

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

No response

Which operating system are you running Bazel on?

windows

What is the output of bazel info release?

bazel 7.2.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

peakschris avatar Jun 27 '24 12:06 peakschris

This does not workaround the issue:

bazel --output_base=output test //... --deleted_packages=output

A workaround is:

echo output >> .bazelignore
bazel --output_base=output test //...

peakschris avatar Jun 27 '24 12:06 peakschris