aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-27 11:45:53 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-27 11:46:27 +0100
commit737e18758cc001a5a98159c3781c6bbbcb19f447 (patch)
tree83033ab74ff8b80ee0e28085a8cfe88e40a9535b /sonar-batch
parente2a31e0005be87b109c7d6a8e1ae4964c14c08a4 (diff)
downloadsonarqube-737e18758cc001a5a98159c3781c6bbbcb19f447.tar.gz
sonarqube-737e18758cc001a5a98159c3781c6bbbcb19f447.zip
SONAR-5737 Drop support of "sonar.importSources" feature
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java14
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java6
2 files changed, 3 insertions, 17 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
index 6492058df74..c203dd73446 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/ComponentIndexer.java
@@ -25,7 +25,6 @@ import com.google.common.io.Files;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchComponent;
-import org.sonar.api.CoreProperties;
import org.sonar.api.batch.SonarIndex;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
@@ -65,11 +64,6 @@ public class ComponentIndexer implements BatchComponent {
public void execute(FileSystem fs) {
migration.migrateIfNeeded(module, fs);
- boolean shouldImportSource = settings.getBoolean(CoreProperties.CORE_IMPORT_SOURCES_PROPERTY);
- if (!shouldImportSource) {
- LOG.warn("/!\\ Property '" + CoreProperties.CORE_IMPORT_SOURCES_PROPERTY
- + "' is deprecated. Not importing source will prevent issues to be properly tracked between consecutive analyses.");
- }
for (InputFile inputFile : fs.inputFiles(fs.predicates().all())) {
String languageKey = inputFile.language();
boolean unitTest = InputFile.Type.TEST == inputFile.type();
@@ -85,12 +79,12 @@ public class ComponentIndexer implements BatchComponent {
}
sonarIndex.index(sonarFile);
- importSources(fs, shouldImportSource, inputFile, sonarFile);
+ importSources(fs, inputFile, sonarFile);
}
}
@VisibleForTesting
- void importSources(FileSystem fs, boolean shouldImportSource, InputFile inputFile, Resource sonarFile) {
+ void importSources(FileSystem fs, InputFile inputFile, Resource sonarFile) {
try {
// TODO this part deserves optimization.
// No need to read full content in memory when shouldImportSource=false
@@ -98,9 +92,7 @@ public class ComponentIndexer implements BatchComponent {
String source = Files.toString(inputFile.file(), fs.encoding());
// SONAR-3860 Remove BOM character from source
source = CharMatcher.anyOf("\uFEFF").removeFrom(source);
- if (shouldImportSource) {
- sonarIndex.setSource(sonarFile, source);
- }
+ sonarIndex.setSource(sonarFile, source);
} catch (Exception e) {
throw new SonarException("Unable to read and import the source file : '" + inputFile.absolutePath() + "' with the charset : '"
+ fs.encoding() + "'.", e);
diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
index 8e90b2b3c68..7ad42ecbcbb 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/scan/filesystem/ComponentIndexerTest.java
@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mockito.ArgumentMatcher;
import org.mockito.exceptions.verification.junit.ArgumentsAreDifferent;
-import org.sonar.api.CoreProperties;
import org.sonar.api.batch.SonarIndex;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
@@ -122,8 +121,6 @@ public class ComponentIndexerTest {
@Test
public void shouldImportSource() throws IOException {
- settings.setProperty(CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, "true");
-
fs.add(newInputFile("src/main/java/foo/bar/Foo.java", "sample code", "foo/bar/Foo.java", "java", false));
Languages languages = new Languages(Java.INSTANCE);
ComponentIndexer indexer = new ComponentIndexer(project, languages, sonarIndex, settings, mock(ResourceKeyMigration.class));
@@ -157,8 +154,6 @@ public class ComponentIndexerTest {
@Test
public void remove_byte_order_mark_character() throws Exception {
- settings.setProperty(CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, "true");
-
File javaFile1 = new File(baseDir, "src/main/java/foo/bar/Foo.java");
FileUtils.write(javaFile1, "\uFEFFpublic class Test", Charsets.UTF_8);
fs.add(new DeprecatedDefaultInputFile("foo", "src/main/java/foo/bar/Foo.java")
@@ -181,7 +176,6 @@ public class ComponentIndexerTest {
}
private void fileEncodingTest(String encoding, String testFile) throws Exception {
- settings.setProperty(CoreProperties.CORE_IMPORT_SOURCES_PROPERTY, "true");
fs.setEncoding(Charset.forName(encoding));
File javaFile1 = new File(baseDir, "src/main/java/foo/bar/Foo.java");