diff options
author | 2015-09-03 13:59:44 +0000 | |
---|---|---|
committer | 2015-09-03 14:42:33 +0000 | |
commit | 54733f93471af0cbe63e9f32a522971dbd193a3e (patch) | |
tree | d7ae030fd727d129f80dd137cf6df3f5ba4fba41 /src/main/java/com/google/devtools/build/lib/runtime | |
parent | 31d6bba4ec2041926063d26c7b53befcb647e8d5 (diff) |
Code cleanup
--
MOS_MIGRATED_REVID=102239051
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
5 files changed, 47 insertions, 50 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java index ddd3cb1585..edd1b92602 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java @@ -819,10 +819,8 @@ public final class BlazeRuntime { eventBus.post(new CommandPrecompleteEvent(originalExit)); // If Blaze did not suffer an infrastructure failure, check for errors in modules. ExitCode exitCode = originalExit; - if (!originalExit.isInfrastructureFailure()) { - if (pendingException != null) { - exitCode = pendingException.getExitCode(); - } + if (!originalExit.isInfrastructureFailure() && pendingException != null) { + exitCode = pendingException.getExitCode(); } pendingException = null; return exitCode; diff --git a/src/main/java/com/google/devtools/build/lib/runtime/FancyTerminalEventHandler.java b/src/main/java/com/google/devtools/build/lib/runtime/FancyTerminalEventHandler.java index a2d03ae2ab..a1242b0e59 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/FancyTerminalEventHandler.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/FancyTerminalEventHandler.java @@ -15,7 +15,7 @@ package com.google.devtools.build.lib.runtime; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; +import com.google.common.collect.Iterators; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.util.Pair; @@ -66,36 +66,36 @@ public class FancyTerminalEventHandler extends BlazeCommandEventHandler { // [1,442 / 23,476] Compiling base/base.cc "^\\[(?:(?:\\d\\d?\\d?%)|(?:[\\d+,]+ / [\\d,]+))\\] "); private static final Splitter LINEBREAK_SPLITTER = Splitter.on('\n'); - private static final List<String> SPECIAL_MESSAGES = ImmutableList.of( - "Reading startup options from " - + "HKEY_LOCAL_MACHINE\\Software\\Google\\Devtools\\Blaze\\CurrentVersion", - "Contacting ftp://microsoft.com/win3.1/downloadcenter", - "Downloading MSVCR71.DLL", - "Installing Windows Update 37 of 118...", - "Sending request to Azure server", - "Checking whether your copy of Blaze is Genuine", - "Initializing HAL", - "Loading NDIS2SUP.VXD", - "Initializing DRM", - "Contacting license server", - "Starting EC2 instances", - "Starting MS-DOS 6.0", - "Updating virus database", - "Linking WIN32.DLL", - "Linking GGL32.EXE", - "Starting ActiveX controls", - "Launching Microsoft Visual Studio 2013", - "Launching IEXPLORE.EXE", - "Initializing BASIC v2.1 interpreter", - "Parsing COM object monikers", - "Notifying field agents", - "Negotiating with killer robots", - "Searching for cellular signal", - "Checking for outstanding GCard expenses", - "Waiting for workstation CPU temperature to decrease" - ); + private static final List<String> SPECIAL_MESSAGES = + ImmutableList.of( + "Reading startup options from " + + "HKEY_LOCAL_MACHINE\\Software\\Google\\Devtools\\Blaze\\CurrentVersion", + "Contacting ftp://microsoft.com/win3.1/downloadcenter", + "Downloading MSVCR71.DLL", + "Installing Windows Update 37 of 118...", + "Sending request to Azure server", + "Checking whether your copy of Blaze is Genuine", + "Initializing HAL", + "Loading NDIS2SUP.VXD", + "Initializing DRM", + "Contacting license server", + "Starting EC2 instances", + "Starting MS-DOS 6.0", + "Updating virus database", + "Linking WIN32.DLL", + "Linking GGL32.EXE", + "Starting ActiveX controls", + "Launching Microsoft Visual Studio 2013", + "Launching IEXPLORE.EXE", + "Initializing BASIC v2.1 interpreter", + "Parsing COM object monikers", + "Notifying field agents", + "Negotiating with killer robots", + "Searching for cellular signal", + "Checking for outstanding GCard expenses", + "Waiting for workstation CPU temperature to decrease"); - private final Iterator<String> messageIterator = Iterables.cycle(SPECIAL_MESSAGES).iterator(); + private final Iterator<String> messageIterator = Iterators.cycle(SPECIAL_MESSAGES); private volatile boolean trySpecial; private volatile Instant skipUntil = Instant.now(); diff --git a/src/main/java/com/google/devtools/build/lib/runtime/TestResultAnalyzer.java b/src/main/java/com/google/devtools/build/lib/runtime/TestResultAnalyzer.java index 33a228c9a1..e9dbd9bbb2 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/TestResultAnalyzer.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/TestResultAnalyzer.java @@ -263,12 +263,13 @@ public class TestResultAnalyzer { .setRanRemotely(result.getData().getIsRemoteStrategy()); List<String> warnings = new ArrayList<>(); - if (status == BlazeTestStatus.PASSED) { - if (shouldEmitTestSizeWarningInSummary( - summaryOptions.testVerboseTimeoutWarnings, - warnings, result.getData().getTestProcessTimesList(), target)) { - summaryBuilder.setWasUnreportedWrongSize(true); - } + if (status == BlazeTestStatus.PASSED + && shouldEmitTestSizeWarningInSummary( + summaryOptions.testVerboseTimeoutWarnings, + warnings, + result.getData().getTestProcessTimesList(), + target)) { + summaryBuilder.setWasUnreportedWrongSize(true); } return summaryBuilder diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java index e168462ad2..4418f1eb8d 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/HelpCommand.java @@ -226,7 +226,7 @@ public final class HelpCommand implements BlazeCommand { for (String name : commands) { BlazeCommand command = commandsByName.get(name); - String varName = name.toUpperCase().replace("-", "_"); + String varName = name.toUpperCase().replace('-', '_'); Command annotation = command.getClass().getAnnotation(Command.class); if (!annotation.completion().isEmpty()) { outErr.printOutLn("BAZEL_COMMAND_" + varName + "_ARGUMENT=\"" diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java index d1f18cefcd..1a0566b9cd 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/InfoCommand.java @@ -365,15 +365,13 @@ public class InfoCommand implements BlazeCommand { AllowedRuleClassInfo.Builder info = AllowedRuleClassInfo.newBuilder(); info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.ANY); - if (attr.isStrictLabelCheckingEnabled()) { - if (attr.getAllowedRuleClassesPredicate() != Predicates.<RuleClass>alwaysTrue()) { - info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.SPECIFIED); - Predicate<RuleClass> filter = attr.getAllowedRuleClassesPredicate(); - for (RuleClass otherClass : Iterables.filter( - ruleClasses, filter)) { - if (otherClass.isDocumented()) { - info.addAllowedRuleClass(otherClass.getName()); - } + if (attr.isStrictLabelCheckingEnabled() + && attr.getAllowedRuleClassesPredicate() != Predicates.<RuleClass>alwaysTrue()) { + info.setPolicy(AllowedRuleClassInfo.AllowedRuleClasses.SPECIFIED); + Predicate<RuleClass> filter = attr.getAllowedRuleClassesPredicate(); + for (RuleClass otherClass : Iterables.filter(ruleClasses, filter)) { + if (otherClass.isDocumented()) { + info.addAllowedRuleClass(otherClass.getName()); } } } |