diff --git a/aswb/src/com/google/idea/blaze/android/run/deployinfo/BlazeApkDeployInfoProtoHelper.java b/aswb/src/com/google/idea/blaze/android/run/deployinfo/BlazeApkDeployInfoProtoHelper.java index aa369a0861b..0c1f1f91555 100644 --- a/aswb/src/com/google/idea/blaze/android/run/deployinfo/BlazeApkDeployInfoProtoHelper.java +++ b/aswb/src/com/google/idea/blaze/android/run/deployinfo/BlazeApkDeployInfoProtoHelper.java @@ -26,6 +26,7 @@ import com.google.idea.blaze.base.command.buildresult.LocalFileArtifact; import com.google.idea.blaze.base.command.buildresult.ParsedBepOutput; import com.google.idea.blaze.base.model.primitives.Label; +import com.google.idea.blaze.common.Interners; import com.google.idea.blaze.common.artifact.OutputArtifact; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -33,6 +34,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.List; +import java.util.Optional; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -55,7 +57,7 @@ public AndroidDeployInfo readDeployInfoProtoForTarget( if (outputArtifacts.isEmpty()) { Logger log = Logger.getInstance(BlazeApkDeployInfoProtoHelper.class.getName()); try { - ParsedBepOutput bepOutput = buildResultHelper.getBuildOutput(); + ParsedBepOutput bepOutput = buildResultHelper.getBuildOutput(Optional.empty(), Interners.STRING); log.warn("Local execroot: " + bepOutput.getLocalExecRoot()); log.warn("All output artifacts:"); for (OutputArtifact outputArtifact : bepOutput.getAllOutputArtifacts(path -> true)) { diff --git a/base/BUILD b/base/BUILD index 75f35502827..897cd27d922 100644 --- a/base/BUILD +++ b/base/BUILD @@ -485,6 +485,7 @@ java_library( ":base", "//shared:artifact", "//shared:exception", + "//shared/java/com/google/idea/blaze/common", "//testing:lib", "//third_party/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto", "//third_party/java/auto_value", @@ -544,6 +545,7 @@ intellij_unit_test_suite( "//querysync/javatests/com/google/idea/blaze/qsync/testdata", "//shared", "//shared:artifact", + "//shared/java/com/google/idea/blaze/common", "//shared/javatests/com/google/idea/blaze/common:test_utils", "//shared/javatests/com/google/idea/blaze/common/artifact:test_utils", "//testing:lib", diff --git a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt index 6a4e0e4ad88..221378b3184 100644 --- a/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt +++ b/base/src/com/google/idea/blaze/base/buildview/BazelExecService.kt @@ -9,6 +9,7 @@ import com.google.idea.blaze.base.model.primitives.WorkspaceRoot import com.google.idea.blaze.base.scope.BlazeContext import com.google.idea.blaze.base.sync.aspects.BlazeBuildOutputs import com.google.idea.blaze.base.sync.aspects.BuildResult +import com.google.idea.blaze.common.Interners import com.google.idea.blaze.common.PrintOutput import com.google.protobuf.CodedInputStream import com.intellij.execution.configurations.PtyCommandLine @@ -27,6 +28,7 @@ import com.intellij.util.ui.EDT import kotlinx.coroutines.* import java.io.BufferedInputStream import java.io.FileInputStream +import java.util.Optional import kotlin.io.path.pathString private val LOG: Logger = Logger.getInstance(BazelExecService::class.java) @@ -185,7 +187,10 @@ class BazelExecService(private val project: Project) : Disposable { if (result.status == BuildResult.Status.FATAL_ERROR) { BlazeBuildOutputs.noOutputs(result) } else { - BlazeBuildOutputs.fromParsedBepOutput(result, provider.getBuildOutput()) + BlazeBuildOutputs.fromParsedBepOutput( + result, + provider.getBuildOutput(Optional.empty(), Interners.STRING), + ) } } } diff --git a/base/src/com/google/idea/blaze/base/command/CommandLineBlazeCommandRunner.java b/base/src/com/google/idea/blaze/base/command/CommandLineBlazeCommandRunner.java index b67aa41e892..d9eabc3538a 100644 --- a/base/src/com/google/idea/blaze/base/command/CommandLineBlazeCommandRunner.java +++ b/base/src/com/google/idea/blaze/base/command/CommandLineBlazeCommandRunner.java @@ -94,7 +94,7 @@ public BlazeBuildOutputs run( Optional.ofNullable(context.getScope(SharedStringPoolScope.class)) .map(SharedStringPoolScope::getStringInterner) .orElse(null); - ParsedBepOutput buildOutput = buildResultHelper.getBuildOutput(stringInterner); + ParsedBepOutput buildOutput = buildResultHelper.getBuildOutput(Optional.empty(), stringInterner); context.output(PrintOutput.log("BEP outputs retrieved (%s).", StringUtilRt.formatFileSize(buildOutput.getBepBytesConsumed()))); return BlazeBuildOutputs.fromParsedBepOutput(buildResult, buildOutput); } catch (GetArtifactsException e) { diff --git a/base/src/com/google/idea/blaze/base/command/buildresult/BuildResultHelper.java b/base/src/com/google/idea/blaze/base/command/buildresult/BuildResultHelper.java index 8e7a6cc95ee..04821996260 100644 --- a/base/src/com/google/idea/blaze/base/command/buildresult/BuildResultHelper.java +++ b/base/src/com/google/idea/blaze/base/command/buildresult/BuildResultHelper.java @@ -20,6 +20,7 @@ import com.google.idea.blaze.base.model.primitives.Label; import com.google.idea.blaze.base.run.testlogs.BlazeTestResults; import com.google.idea.blaze.base.scope.BlazeContext; +import com.google.idea.blaze.common.Interners; import com.google.idea.blaze.common.artifact.OutputArtifact; import com.google.idea.blaze.exception.BuildException; import java.io.InputStream; @@ -46,46 +47,9 @@ public interface BuildResultHelper extends AutoCloseable { * getBuildOutput may restrict parallelism for cases in which many builds are executed in parallel * (e.g. remote builds). */ - default ParsedBepOutput getBuildOutput() throws GetArtifactsException { - return getBuildOutput(Optional.empty()); - } - - /** - * Parses the BEP output data and returns the corresponding {@link ParsedBepOutput}. May only be - * called once, after the build is complete. - * - *
As BEP retrieval can be memory-intensive for large projects, implementations of
- * getBuildOutput may restrict parallelism for cases in which many builds are executed in parallel
- * (e.g. remote builds).
- */
- default ParsedBepOutput getBuildOutput(Interner As BEP retrieval can be memory-intensive for large projects, implementations of
- * getBuildOutput may restrict parallelism for cases in which many builds are executed in parallel
- * (e.g. remote builds).
- */
- default ParsedBepOutput getBuildOutput(
+ ParsedBepOutput getBuildOutput(
Optional As BEP retrieval can be memory-intensive for large projects, implementations of
- * getBuildOutput may restrict parallelism for cases in which many builds are executed in parallel
- * (e.g. remote builds).
- */
- ParsedBepOutput getBuildOutput(Optional