From b16c02760d933b45d519b2f5c1f4529aac574df5 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 2 Apr 2015 18:13:52 +0200 Subject: SONAR-6277 Feed file sources in compute report --- .../batch/protocol/output/BatchReportWriter.java | 4 +++ .../sonar/batch/protocol/output/FileStructure.java | 30 ++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'sonar-batch-protocol') 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 97b7e5f2caa..86ec1c53f6e 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 @@ -118,4 +118,8 @@ public class BatchReportWriter { ProtobufUtil.writeMessagesToFile(coverageList, file); } + public File getSourceFile(int componentRef) { + return fileStructure.fileFor(FileStructure.Domain.SOURCE, componentRef); + } + } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java index 21df5a4cafb..e0add6865a0 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java @@ -27,22 +27,24 @@ import java.io.File; public class FileStructure { public enum Domain { - ISSUES("issues-"), - ISSUES_ON_DELETED("issues-deleted-"), - COMPONENT("component-"), - MEASURES("measures-"), - DUPLICATIONS("duplications-"), - SYNTAX_HIGHLIGHTING("syntax-highlighting-"), - SCM("scm-"), - SYMBOLS("symbol-"), - COVERAGE("coverage-"), - SOURCE("source-") - ; - + ISSUES("issues-", Domain.PB), + ISSUES_ON_DELETED("issues-deleted-", Domain.PB), + COMPONENT("component-", Domain.PB), + MEASURES("measures-", Domain.PB), + DUPLICATIONS("duplications-", Domain.PB), + SYNTAX_HIGHLIGHTING("syntax-highlighting-", Domain.PB), + SCM("scm-", Domain.PB), + SYMBOLS("symbol-", Domain.PB), + COVERAGE("coverage-", Domain.PB), + SOURCE("source-", ".txt"); + + private static final String PB = ".pb"; private final String filePrefix; + private final String fileSuffix; - Domain(String filePrefix) { + Domain(String filePrefix, String fileSuffix) { this.filePrefix = filePrefix; + this.fileSuffix = fileSuffix; } } @@ -60,7 +62,7 @@ public class FileStructure { } public File fileFor(Domain domain, int componentRef) { - return new File(dir, domain.filePrefix + componentRef + ".pb"); + return new File(dir, domain.filePrefix + componentRef + domain.fileSuffix); } } -- cgit v1.2.3