import org.sonar.api.BatchComponent;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.resources.Project;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.batch.bootstrap.AnalysisMode;
private final StatusDetectionFactory statusDetectionFactory;
private final AnalysisMode analysisMode;
- public InputFileBuilderFactory(Project module, ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
- StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) {
- this(module.getEffectiveKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
- }
-
- /**
- * Used by scan2
- */
public InputFileBuilderFactory(ProjectDefinition def, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
StatusDetectionFactory statusDetectionFactory, AnalysisMode analysisMode) {
- this(def.getKey(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
+ this(def.getKeyWithBranch(), pathResolver, langDetectionFactory, statusDetectionFactory, analysisMode);
}
private InputFileBuilderFactory(String effectiveKey, PathResolver pathResolver, LanguageDetectionFactory langDetectionFactory,
package org.sonar.batch.scan2;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.MetricFinder;
import org.sonar.api.measures.FileLinesContext;
private final ProjectDefinition def;
private InputPathCache fileCache;
- public DefaultFileLinesContextFactory(InputPathCache fileCache, FileSystem fs, MetricFinder metricFinder, AnalyzerMeasureCache measureCache,
+ public DefaultFileLinesContextFactory(InputPathCache fileCache, MetricFinder metricFinder, AnalyzerMeasureCache measureCache,
ProjectDefinition def) {
this.fileCache = fileCache;
this.metricFinder = metricFinder;
@Override
protected void doAfterStart() {
- getComponentByType(ModuleScanExecutor.class).execute(moduleDefinition);
+ getComponentByType(ModuleScanExecutor.class).execute();
}
}
package org.sonar.batch.scan2;
import com.google.common.collect.Lists;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader;
import org.sonar.batch.rule.QProfileVerifier;
/**
* Executed on each module
*/
- public void execute(ProjectDefinition moduleDefinition) {
+ public void execute() {
fsLogger.log();
// Index and lock the filesystem
import org.junit.Test;
import org.mockito.Mockito;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.resources.Project;
import org.sonar.api.scan.filesystem.PathResolver;
import org.sonar.batch.bootstrap.AnalysisMode;
@Test
public void create_builder() throws Exception {
PathResolver pathResolver = new PathResolver();
- Project project = new Project("struts");
LanguageDetectionFactory langDetectionFactory = mock(LanguageDetectionFactory.class, Mockito.RETURNS_MOCKS);
StatusDetectionFactory statusDetectionFactory = mock(StatusDetectionFactory.class, Mockito.RETURNS_MOCKS);
DefaultModuleFileSystem fs = mock(DefaultModuleFileSystem.class);
AnalysisMode analysisMode = mock(AnalysisMode.class);
- InputFileBuilderFactory factory = new InputFileBuilderFactory(
- project, ProjectDefinition.create(), pathResolver, langDetectionFactory,
+ InputFileBuilderFactory factory = new InputFileBuilderFactory(ProjectDefinition.create().setKey("struts"), pathResolver, langDetectionFactory,
statusDetectionFactory, analysisMode);
InputFileBuilder builder = factory.create(fs);