Skip to content

Commit

Permalink
Automated rollback of commit dafe713.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Breaks Bazel CI (https://ci.bazel.build/job/bazel-tests/1722/)

*** Original change description ***

Report unsuccessful error code if bazel fetch fails in "keep going" mode.

Fixes bazelbuild#3234.

PiperOrigin-RevId: 182042503
  • Loading branch information
dslomov authored and Copybara-Service committed Jan 16, 2018
1 parent 0350ad3 commit 290970c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.devtools.build.lib.pkgcache.PackageCacheOptions;
import com.google.devtools.build.lib.query2.AbstractBlazeQueryEnvironment;
import com.google.devtools.build.lib.query2.engine.QueryEnvironment.Setting;
import com.google.devtools.build.lib.query2.engine.QueryEvalResult;
import com.google.devtools.build.lib.query2.engine.QueryException;
import com.google.devtools.build.lib.query2.engine.QueryExpression;
import com.google.devtools.build.lib.query2.engine.ThreadSafeOutputFormatterCallback;
Expand Down Expand Up @@ -123,17 +122,13 @@ public ExitCode exec(CommandEnvironment env, OptionsProvider options) {
env.getCommandId().toString()));

// 2. Evaluate expression:
QueryEvalResult queryEvalResult = null;
try {
queryEvalResult =
queryEnv.evaluateQuery(
expr,
new ThreadSafeOutputFormatterCallback<Target>() {
@Override
public void processOutput(Iterable<Target> partialResult) {
// Throw away the result.
}
});
queryEnv.evaluateQuery(expr, new ThreadSafeOutputFormatterCallback<Target>() {
@Override
public void processOutput(Iterable<Target> partialResult) {
// Throw away the result.
}
});
} catch (InterruptedException e) {
env.getReporter()
.post(
Expand All @@ -153,15 +148,12 @@ public void processOutput(Iterable<Target> partialResult) {
throw new IllegalStateException(e);
}

if (!queryEvalResult.getSuccess()) {
env.getReporter().handle(Event.progress("All external dependencies fetched successfully."));
}
ExitCode exitCode =
queryEvalResult.getSuccess() ? ExitCode.SUCCESS : ExitCode.COMMAND_LINE_ERROR;
env.getReporter().handle(
Event.progress("All external dependencies fetched successfully."));
env.getReporter()
.post(
new NoBuildRequestFinishedEvent(
exitCode, env.getRuntime().getClock().currentTimeMillis()));
return exitCode;
ExitCode.SUCCESS, env.getRuntime().getClock().currentTimeMillis()));
return ExitCode.SUCCESS;
}
}
16 changes: 0 additions & 16 deletions src/test/shell/bazel/external_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -948,20 +948,4 @@ EOF
|| fail 'Expected @ext//:foo and //:foo not to conflict'
}

function test_failing_fetch_with_keep_going() {
touch WORKSPACE
cat > BUILD <<'EOF'
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "hello-world",
srcs = ["hello-world.cc"],
deps = ["@fake//:fake"],
)
EOF
touch hello-world.cc

bazel fetch --keep_going //... >& $TEST_log && fail "Expected to fail" || true
}

run_suite "external tests"

0 comments on commit 290970c

Please sign in to comment.