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

.bazelignore breaks build #5974

Closed
guibou opened this issue Aug 23, 2018 · 3 comments
Closed

.bazelignore breaks build #5974

guibou opened this issue Aug 23, 2018 · 3 comments
Labels
team-Bazel General Bazel product/strategy issues untriaged

Comments

@guibou
Copy link
Contributor

guibou commented Aug 23, 2018

Description of the problem / feature request:

I tried bazel 0.17.0rc1. I'm interested by the .bazelignore file. It does works, meaning that bazel build //... is correctly ignoring the subdirectory listed in .bazelignore, however build are always failing when I'm building a more specific target, such as //foo/....

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

  • Install bazel 0.17rc1.
[nix-shell:/tmp]$ mkdir test_bazel
[nix-shell:/tmp]$ cd test_bazel/
[nix-shell:/tmp/test_bazel]$ touch WORKSPACE
[nix-shell:/tmp/test_bazel]$ mkdir a
[nix-shell:/tmp/test_bazel]$ touch BUILD
[nix-shell:/tmp/test_bazel]$ touch a/BUILD

Building works:

[nix-shell:/tmp/test_bazel]$ bazel build //...
Starting local Bazel server and connecting to it...
INFO: Analysed 0 targets (4 packages loaded).
INFO: Found 0 targets...
INFO: Elapsed time: 1.621s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

[nix-shell:/tmp/test_bazel]$ bazel build //a/...
INFO: Analysed 0 targets (0 packages loaded).
INFO: Found 0 targets...
INFO: Elapsed time: 0.135s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

Now I edit .bazelignore:

[nix-shell:/tmp/test_bazel]$ echo "ignore" > .bazelignore

Global building works:

[nix-shell:/tmp/test_bazel]$ bazel build //...
INFO: Analysed 0 targets (0 packages loaded).
INFO: Found 0 targets...
INFO: Elapsed time: 0.111s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action

However building with a specific target is now broken:

[nix-shell:/tmp/test_bazel]$ bazel build //a/...
Unhandled exception thrown during build; message: Unrecoverable error while evaluating node '//a/...' (requested by nodes '[//a/...] EXPAND_TEST_SUITES com.google.devtools.build.lib.pkgcache.TestFilter@e17a1')
INFO: Elapsed time: 0.043s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
java.lang.RuntimeException: Unrecoverable error while evaluating node '//a/...' (requested by nodes '[//a/...] EXPAND_TEST_SUITES com.google.devtools.build.lib.pkgcache.TestFilter@e17a1')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:497)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:368)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: ignore is not beneath a
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:440)
	at com.google.devtools.build.lib.vfs.PathFragment.checkAllPathsAreUnder(PathFragment.java:721)
	at com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.getPackagesUnderDirectory(EnvironmentBackedRecursivePackageProvider.java:147)
	at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectoryAsyncImpl(RecursivePackageProviderBackedTargetPatternResolver.java:264)
	at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectory(RecursivePackageProviderBackedTargetPatternResolver.java:209)
	at com.google.devtools.build.lib.cmdline.TargetPattern$TargetsBelowDirectory.eval(TargetPattern.java:578)
	at com.google.devtools.build.lib.skyframe.TargetPatternFunction.compute(TargetPatternFunction.java:77)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:420)
	... 4 more
java.lang.RuntimeException: Unrecoverable error while evaluating node '//a/...' (requested by nodes '[//a/...] EXPAND_TEST_SUITES com.google.devtools.build.lib.pkgcache.TestFilter@e17a1')
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:497)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:368)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: ignore is not beneath a
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:440)
	at com.google.devtools.build.lib.vfs.PathFragment.checkAllPathsAreUnder(PathFragment.java:721)
	at com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.getPackagesUnderDirectory(EnvironmentBackedRecursivePackageProvider.java:147)
	at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectoryAsyncImpl(RecursivePackageProviderBackedTargetPatternResolver.java:264)
	at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectory(RecursivePackageProviderBackedTargetPatternResolver.java:209)
	at com.google.devtools.build.lib.cmdline.TargetPattern$TargetsBelowDirectory.eval(TargetPattern.java:578)
	at com.google.devtools.build.lib.skyframe.TargetPatternFunction.compute(TargetPatternFunction.java:77)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:420)
FAILED: Build did NOT complete successfully (0 packages loaded)

What operating system are you running Bazel on?

  • Linux (NixOS)

What's the output of bazel info release?

release 0.16.1- (@non-git)

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

I used the nixpkgs bazel receipt in which I changed the src url pointing to bazel 0.15.2 to bazel 0.17.0rc1. I also had to override the jdk used by setting build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8" in the .bazelrc file used for the build.

I used for src:

url = "https://releases.bazel.build/0.17.0/rc1/bazel-0.17.0rc1-dist.zip";
sha256 = "46dfffac884ccd51fcb493dd86463cb8c21be949fdb17634ca37805fd544beae";

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

Not relevant.

Have you found anything relevant by searching the web?

no.

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

no.

@jin jin added untriaged team-Bazel General Bazel product/strategy issues labels Aug 26, 2018
bazel-io pushed a commit that referenced this issue Sep 14, 2018
Now that .bazelignore is functional (with 8570ee2 making
those directories fully ignored, even if containing symlink
cycles, and 6f8e36b fixing #5974), we can document this file.

Change-Id: Ib8ea7253c317b6c0ebee53f1d1c57c787a0b401b
PiperOrigin-RevId: 212996459
@ixdy
Copy link
Contributor

ixdy commented Sep 17, 2018

did this fix not make it into 0.17.1?

@nicolasalt
Copy link

Still reproducing on Bazel 0.17.2:

Build label: 0.17.2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Sep 21 10:31:42 2018 (1537525902)
Build timestamp: 1537525902
Build timestamp as int: 1537525902

@nicolasalt
Copy link

The error references EnvironmentBackedRecursivePackageProvider so this fix probably didn't make it to 0.17.2:

Caused by: java.lang.IllegalArgumentException: ignore is not beneath a
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:440)
at com.google.devtools.build.lib.vfs.PathFragment.checkAllPathsAreUnder(PathFragment.java:721)
at com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.getPackagesUnderDirectory(EnvironmentBackedRecursivePackageProvider.java:147)
at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectoryAsyncImpl(RecursivePackageProviderBackedTargetPatternResolver.java:264)
at com.google.devtools.build.lib.skyframe.RecursivePackageProviderBackedTargetPatternResolver.findTargetsBeneathDirectory(RecursivePackageProviderBackedTargetPatternResolver.java:209)
at com.google.devtools.build.lib.cmdline.TargetPattern$TargetsBelowDirectory.eval(TargetPattern.java:578)
at com.google.devtools.build.lib.skyframe.TargetPatternFunction.compute(TargetPatternFunction.java:77)
at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:420)
... 4 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Bazel General Bazel product/strategy issues untriaged
Projects
None yet
Development

No branches or pull requests

4 participants