aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-04-02 18:13:52 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-04-07 17:21:33 +0200
commitb16c02760d933b45d519b2f5c1f4529aac574df5 (patch)
tree7730fc290bcf4f3fe978399d5bda328cf191f687 /sonar-batch-protocol
parenta9de737d0e2b6342c55a946665af99a35a7f2cb8 (diff)
downloadsonarqube-b16c02760d933b45d519b2f5c1f4529aac574df5.tar.gz
sonarqube-b16c02760d933b45d519b2f5c1f4529aac574df5.zip
SONAR-6277 Feed file sources in compute report
Diffstat (limited to 'sonar-batch-protocol')
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportWriter.java4
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java30
2 files changed, 20 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 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);
}
}