summaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-05-25 18:02:12 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-06-01 17:08:28 +0200
commit0404aea2db6cde052c6ac4fbd5b2b8097f1a1846 (patch)
tree10a80ed4f72a4fde3a999c6a695cd54bc8988cfa /sonar-batch-protocol
parenta4867b7161c2d7a04ee28bccaca8c09a37087177 (diff)
downloadsonarqube-0404aea2db6cde052c6ac4fbd5b2b8097f1a1846.tar.gz
sonarqube-0404aea2db6cde052c6ac4fbd5b2b8097f1a1846.zip
SONAR-6590 use a CE specific interface to read batch report
Diffstat (limited to 'sonar-batch-protocol')
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java39
1 files changed, 25 insertions, 14 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
index 9a58c825c0b..1a771af3b41 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java
@@ -19,9 +19,8 @@
*/
package org.sonar.batch.protocol.output;
-import org.sonar.batch.protocol.ProtobufUtil;
-
import java.io.File;
+import org.sonar.batch.protocol.ProtobufUtil;
public class BatchReportWriter {
@@ -46,83 +45,95 @@ public class BatchReportWriter {
/**
* Metadata is mandatory
*/
- public void writeMetadata(BatchReport.Metadata metadata) {
+ public File writeMetadata(BatchReport.Metadata metadata) {
ProtobufUtil.writeToFile(metadata, fileStructure.metadataFile());
+ return fileStructure.metadataFile();
}
- public void writeComponent(BatchReport.Component component) {
+ public File writeComponent(BatchReport.Component component) {
File file = fileStructure.fileFor(FileStructure.Domain.COMPONENT, component.getRef());
ProtobufUtil.writeToFile(component, file);
+ return file;
}
- public void writeComponentIssues(int componentRef, Iterable<BatchReport.Issue> issues) {
+ public File writeComponentIssues(int componentRef, Iterable<BatchReport.Issue> issues) {
BatchReport.Issues.Builder issuesBuilder = BatchReport.Issues.newBuilder();
issuesBuilder.setComponentRef(componentRef);
issuesBuilder.addAllIssue(issues);
File file = fileStructure.fileFor(FileStructure.Domain.ISSUES, componentRef);
ProtobufUtil.writeToFile(issuesBuilder.build(), file);
+ return file;
}
- public void writeComponentMeasures(int componentRef, Iterable<BatchReport.Measure> measures) {
+ public File writeComponentMeasures(int componentRef, Iterable<BatchReport.Measure> measures) {
BatchReport.Measures.Builder measuresBuilder = BatchReport.Measures.newBuilder();
measuresBuilder.setComponentRef(componentRef);
measuresBuilder.addAllMeasure(measures);
File file = fileStructure.fileFor(FileStructure.Domain.MEASURES, componentRef);
ProtobufUtil.writeToFile(measuresBuilder.build(), file);
+ return file;
}
- public void writeComponentChangesets(BatchReport.Changesets changesets) {
+ public File writeComponentChangesets(BatchReport.Changesets changesets) {
File file = fileStructure.fileFor(FileStructure.Domain.CHANGESETS, changesets.getComponentRef());
ProtobufUtil.writeToFile(changesets, file);
+ return file;
}
/**
* Issues on components which have been deleted are stored in another location.
* Temporary hack, waiting for computation stack
*/
- public void writeDeletedComponentIssues(int componentRef, String componentUuid, Iterable<BatchReport.Issue> issues) {
+ public File writeDeletedComponentIssues(int componentRef, String componentUuid, Iterable<BatchReport.Issue> issues) {
BatchReport.Issues.Builder issuesBuilder = BatchReport.Issues.newBuilder();
issuesBuilder.setComponentRef(componentRef);
issuesBuilder.setComponentUuid(componentUuid);
issuesBuilder.addAllIssue(issues);
File file = fileStructure.fileFor(FileStructure.Domain.ISSUES_ON_DELETED, componentRef);
ProtobufUtil.writeToFile(issuesBuilder.build(), file);
+ return file;
}
- public void writeComponentDuplications(int componentRef, Iterable<BatchReport.Duplication> duplications) {
+ public File writeComponentDuplications(int componentRef, Iterable<BatchReport.Duplication> duplications) {
BatchReport.Duplications.Builder builder = BatchReport.Duplications.newBuilder();
builder.setComponentRef(componentRef);
builder.addAllDuplication(duplications);
File file = fileStructure.fileFor(FileStructure.Domain.DUPLICATIONS, componentRef);
ProtobufUtil.writeToFile(builder.build(), file);
+ return file;
}
- public void writeComponentSymbols(int componentRef, Iterable<BatchReport.Symbols.Symbol> symbols) {
+ public File writeComponentSymbols(int componentRef, Iterable<BatchReport.Symbols.Symbol> symbols) {
BatchReport.Symbols.Builder builder = BatchReport.Symbols.newBuilder();
builder.setFileRef(componentRef);
builder.addAllSymbol(symbols);
File file = fileStructure.fileFor(FileStructure.Domain.SYMBOLS, componentRef);
ProtobufUtil.writeToFile(builder.build(), file);
+ return file;
}
- public void writeComponentSyntaxHighlighting(int componentRef, Iterable<BatchReport.SyntaxHighlighting> syntaxHighlightingRules) {
+ public File writeComponentSyntaxHighlighting(int componentRef, Iterable<BatchReport.SyntaxHighlighting> syntaxHighlightingRules) {
File file = fileStructure.fileFor(FileStructure.Domain.SYNTAX_HIGHLIGHTINGS, componentRef);
ProtobufUtil.writeMessagesToFile(syntaxHighlightingRules, file);
+ return file;
}
- public void writeComponentCoverage(int componentRef, Iterable<BatchReport.Coverage> coverageList) {
+ public File writeComponentCoverage(int componentRef, Iterable<BatchReport.Coverage> coverageList) {
File file = fileStructure.fileFor(FileStructure.Domain.COVERAGES, componentRef);
ProtobufUtil.writeMessagesToFile(coverageList, file);
+ return file;
}
- public void writeTests(int componentRef, Iterable<BatchReport.Test> tests) {
+ public File writeTests(int componentRef, Iterable<BatchReport.Test> tests) {
File file = fileStructure.fileFor(FileStructure.Domain.TESTS, componentRef);
ProtobufUtil.writeMessagesToFile(tests, file);
+ return file;
}
- public void writeCoverageDetails(int componentRef, Iterable<BatchReport.CoverageDetail> tests) {
+ public File writeCoverageDetails(int componentRef, Iterable<BatchReport.CoverageDetail> tests) {
File file = fileStructure.fileFor(FileStructure.Domain.COVERAGE_DETAILS, componentRef);
ProtobufUtil.writeMessagesToFile(tests, file);
+ return file;
}
public File getSourceFile(int componentRef) {