Skip to content

.bazelignore breaks build #5974

Closed
Closed

Description

@guibou

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.

Activity

  1. added
    untriaged
    team-Bazel
    on Aug 26, 2018
  2. ixdy commented on Sep 17, 2018

    @ixdy
    Contributor

    did this fix not make it into 0.17.1?

  3. nicolasalt commented on Sep 27, 2018

    @nicolasalt

    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

  4. nicolasalt commented on Sep 27, 2018

    @nicolasalt

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    team-Bazeluntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions