-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix JSON format for aquery analysis_v2.proto.
The JSON format doesn't work with the streamed output since by nature it needs to be grouped by message type. This CL adds a monolithic output handler for analysis_v2.proto that can be used for JSON format. RELNOTES: None PiperOrigin-RevId: 289815268
- Loading branch information
1 parent
5e1847c
commit d2343d9
Showing
14 changed files
with
272 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/main/java/com/google/devtools/build/lib/skyframe/actiongraph/v2/AqueryOutputHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2020 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.skyframe.actiongraph.v2; | ||
|
||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.Action; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.Artifact; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.AspectDescriptor; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.Configuration; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.DepSetOfFiles; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.PathFragment; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.RuleClass; | ||
import com.google.devtools.build.lib.analysis.AnalysisProtosV2.Target; | ||
import java.io.IOException; | ||
|
||
/** Outputs various messages of analysis_v2.proto. */ | ||
public interface AqueryOutputHandler { | ||
/** Defines the types of proto output this class can handle. */ | ||
enum OutputType { | ||
BINARY("proto"), | ||
TEXT("textproto"), | ||
JSON("jsonproto"); | ||
|
||
private final String formatName; | ||
|
||
OutputType(String formatName) { | ||
this.formatName = formatName; | ||
} | ||
|
||
public String formatName() { | ||
return formatName; | ||
} | ||
} | ||
|
||
void outputArtifact(Artifact message) throws IOException; | ||
|
||
void outputAction(Action message) throws IOException; | ||
|
||
void outputTarget(Target message) throws IOException; | ||
|
||
void outputDepSetOfFiles(DepSetOfFiles message) throws IOException; | ||
|
||
void outputConfiguration(Configuration message) throws IOException; | ||
|
||
void outputAspectDescriptor(AspectDescriptor message) throws IOException; | ||
|
||
void outputRuleClass(RuleClass message) throws IOException; | ||
|
||
void outputPathFragment(PathFragment message) throws IOException; | ||
|
||
/** Called at the end of the query process. */ | ||
void close() throws IOException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.