diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java index 3bc25730b26..3facf16ee8e 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/buildeventservice/BuildEventServiceModule.java @@ -69,8 +69,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.time.Duration; -import java.util.HashMap; -import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; @@ -424,9 +422,7 @@ public void blazeShutdown() { } } - private void waitForBuildEventTransportsToClose( - Map> transportFutures) - throws AbruptExitException { + private void waitForBuildEventTransportsToClose() throws AbruptExitException { final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder().setNameFormat("bes-notify-ui-%d").build()); @@ -434,7 +430,7 @@ private void waitForBuildEventTransportsToClose( try { // Notify the UI handler when a transport finished closing. - transportFutures.forEach( + closeFuturesWithTimeoutsMap.forEach( (bepTransport, closeFuture) -> closeFuture.addListener( () -> { @@ -443,7 +439,8 @@ private void waitForBuildEventTransportsToClose( executor)); try (AutoProfiler p = AutoProfiler.logged("waiting for BES close", logger)) { - Uninterruptibles.getUninterruptibly(Futures.allAsList(transportFutures.values())); + Uninterruptibles.getUninterruptibly( + Futures.allAsList(closeFuturesWithTimeoutsMap.values())); } } catch (ExecutionException e) { // Futures.withTimeout wraps the TimeoutException in an ExecutionException when the future @@ -514,24 +511,21 @@ private void closeBepTransports() throws AbruptExitException { constructCloseFuturesMapWithTimeouts(streamer.getCloseFuturesMap()); halfCloseFuturesWithTimeoutsMap = constructCloseFuturesMapWithTimeouts(streamer.getHalfClosedMap()); + switch (besOptions.besUploadMode) { + case WAIT_FOR_UPLOAD_COMPLETE: + waitForBuildEventTransportsToClose(); + return; - Map> blockingTransportFutures = new HashMap<>(); - for (Map.Entry> entry : - closeFuturesWithTimeoutsMap.entrySet()) { - BuildEventTransport bepTransport = entry.getKey(); - if (!bepTransport.mayBeSlow() - || besOptions.besUploadMode - == BuildEventServiceOptions.BesUploadMode.WAIT_FOR_UPLOAD_COMPLETE) { - blockingTransportFutures.put(bepTransport, entry.getValue()); - } else { + case NOWAIT_FOR_UPLOAD_COMPLETE: + case FULLY_ASYNC: // When running asynchronously notify the UI immediately since we won't wait for the // uploads to close. - reporter.post(new BuildEventTransportClosedEvent(bepTransport)); - } - } - if (!blockingTransportFutures.isEmpty()) { - waitForBuildEventTransportsToClose(blockingTransportFutures); + for (BuildEventTransport bepTransport : bepTransports) { + reporter.post(new BuildEventTransportClosedEvent(bepTransport)); + } + return; } + throw new IllegalStateException("Unknown BesUploadMode found: " + besOptions.besUploadMode); } @Override diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java index c18335e6ee1..6be7cb545d6 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java @@ -290,8 +290,7 @@ private CompilationInfo compile( // TODO(b/70777494): Find out how deps get used and remove if not needed. Iterable deps, ObjcCppSemantics semantics, - String purpose, - boolean generateModuleMap) + String purpose) throws RuleErrorException { CcCompilationHelper result = new CcCompilationHelper( @@ -337,7 +336,7 @@ private CompilationInfo compile( result.addNonModuleMapHeader(pchHdr); } - if (getCustomModuleMap(ruleContext).isPresent() || !generateModuleMap) { + if (getCustomModuleMap(ruleContext).isPresent()) { result.doNotGenerateModuleMap(); } @@ -387,8 +386,7 @@ private Pair>> cc pchHdr, deps, semantics, - purpose, - /* generateModuleMap= */ true); + purpose); purpose = String.format("%s_non_objc_arc", semantics.getPurpose()); extensionBuilder.setArcEnabled(false); @@ -406,9 +404,7 @@ private Pair>> cc pchHdr, deps, semantics, - purpose, - // Only generate the module map once (see above) and re-use it here. - /* generateModuleMap= */ false); + purpose); FeatureConfiguration featureConfiguration = getFeatureConfiguration(ruleContext, ccToolchain, buildConfiguration, objcProvider); diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java index bfe6c7c4a81..513d2109728 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java @@ -345,7 +345,8 @@ private BlazeCommandResult execExclusively( } try (SilentCloseable closeable = Profiler.instance().profile("setup event handler")) { - UiOptions eventHandlerOptions = options.getOptions(UiOptions.class); + BlazeCommandEventHandler.Options eventHandlerOptions = + options.getOptions(BlazeCommandEventHandler.Options.class); OutErr colorfulOutErr = outErr; if (!eventHandlerOptions.useColor()) { @@ -641,7 +642,8 @@ private OptionsParser createOptionsParser(BlazeCommand command) } /** Returns the event handler to use for this Blaze command. */ - private EventHandler createEventHandler(OutErr outErr, UiOptions eventOptions) { + private EventHandler createEventHandler( + OutErr outErr, BlazeCommandEventHandler.Options eventOptions) { Path workspacePath = runtime.getWorkspace().getDirectories().getWorkspace(); PathFragment workspacePathFragment = workspacePath == null ? null : workspacePath.asFragment(); return new ExperimentalEventHandler( diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandEventHandler.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandEventHandler.java index b62ba6fb95b..23f94fcf83c 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandEventHandler.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandEventHandler.java @@ -79,21 +79,23 @@ public static class Options extends OptionsBase { public double showProgressRateLimit; @Option( - name = "color", - defaultValue = "auto", - converter = UseColorConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = "Use terminal controls to colorize output.") + name = "color", + defaultValue = "auto", + converter = UseColorConverter.class, + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = "Use terminal controls to colorize output going to stderr." + ) public UseColor useColorEnum; @Option( - name = "curses", - defaultValue = "auto", - converter = UseCursesConverter.class, - documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = "Use terminal cursor controls to minimize scrolling output.") + name = "curses", + defaultValue = "auto", + converter = UseCursesConverter.class, + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = "Use terminal cursor controls to minimize scrolling output going to stderr." + ) public UseCurses useCursesEnum; @Option( @@ -107,20 +109,21 @@ public static class Options extends OptionsBase { public int terminalColumns; @Option( - name = "isatty", - // TODO(b/137881511): Old name should be removed after 2020-01-01, or whenever is - // reasonable. - oldName = "is_stderr_atty", - defaultValue = "false", - metadataTags = {OptionMetadataTag.HIDDEN}, - documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, - effectTags = {OptionEffectTag.UNKNOWN}, - help = - "A system-generated parameter which is used to notify the " - + "server whether this client is running in a terminal. " - + "If this is set to false, then '--color=auto' will be treated as '--color=no'. " - + "If this is set to true, then '--color=auto' will be treated as '--color=yes'.") - public boolean isATty; + name = "is_stderr_atty", + // TODO(b/63386499): Old name should be removed after 2019-02-28. + oldName = "isatty", + defaultValue = "false", + metadataTags = {OptionMetadataTag.HIDDEN}, + documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = + "A system-generated parameter which is used to notify the server whether this client is" + + " running in a terminal. If this is set to false, then '--color=auto' will be" + + " treated as '--color=no'. If this is set to true, then '--color=auto' will be" + + " treated as '--color=yes'. As we only treat the stderr as a terminal, we only" + + " care if that file descriptor is connected to a TTY." + ) + public boolean isStderrATty; // This lives here (as opposed to the more logical BuildRequest.Options) // because the client passes it to the server *always*. We don't want the @@ -253,11 +256,11 @@ public static class Options extends OptionsBase { public boolean experimentalUiDeduplicate; public boolean useColor() { - return useColorEnum == UseColor.YES || (useColorEnum == UseColor.AUTO && isATty); + return useColorEnum == UseColor.YES || (useColorEnum == UseColor.AUTO && isStderrATty); } public boolean useCursorControl() { - return useCursesEnum == UseCurses.YES || (useCursesEnum == UseCurses.AUTO && isATty); + return useCursesEnum == UseCurses.YES || (useCursesEnum == UseCurses.AUTO && isStderrATty); } } }