use of org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.
the class PersistAnalysisStep method execute.
@Override
public void execute(ComputationStep.Context context) {
try (DbSession dbSession = dbClient.openSession(false)) {
new DepthTraversalTypeAwareCrawler(new PersistSnapshotsPathAwareVisitor(dbSession, analysisMetadataHolder.getAnalysisDate())).visit(treeRootHolder.getRoot());
dbSession.commit();
}
}
use of org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.
the class PersistCrossProjectDuplicationIndexStep method execute.
@Override
public void execute(ComputationStep.Context context) {
if (!crossProjectDuplicationStatusHolder.isEnabled()) {
return;
}
try (DbSession dbSession = dbClient.openSession(true)) {
Component project = treeRootHolder.getRoot();
DuplicationVisitor visitor = new DuplicationVisitor(dbSession, analysisMetadataHolder.getUuid());
new DepthTraversalTypeAwareCrawler(visitor).visit(project);
dbSession.commit();
context.getStatistics().add("inserts", visitor.count);
}
}
use of org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.
the class PersistDuplicationDataStep method execute.
@Override
public void execute(ComputationStep.Context context) {
boolean supportUpsert = dbClient.getDatabase().getDialect().supportsUpsert();
// structure (same PreparedStatement))
try (DbSession dbSession = dbClient.openSession(false);
DuplicationVisitor visitor = new DuplicationVisitor(dbSession, supportUpsert)) {
new DepthTraversalTypeAwareCrawler(visitor).visit(treeRootHolder.getRoot());
context.getStatistics().add("insertsOrUpdates", visitor.insertsOrUpdates);
}
}
use of org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.
the class PersistLiveMeasuresStep method execute.
@Override
public void execute(ComputationStep.Context context) {
boolean supportUpsert = dbClient.getDatabase().getDialect().supportsUpsert();
try (DbSession dbSession = dbClient.openSession(true)) {
Component root = treeRootHolder.getRoot();
MeasureVisitor visitor = new MeasureVisitor(dbSession, supportUpsert);
new DepthTraversalTypeAwareCrawler(visitor).visit(root);
dbSession.commit();
context.getStatistics().add("insertsOrUpdates", visitor.insertsOrUpdates);
}
}
use of org.sonar.ce.task.projectanalysis.component.DepthTraversalTypeAwareCrawler in project sonarqube by SonarSource.
the class ValidateProjectStep method execute.
@Override
public void execute(ComputationStep.Context context) {
try (DbSession dbSession = dbClient.openSession(false)) {
validateTargetBranch(dbSession);
Component root = treeRootHolder.getRoot();
// FIXME if module have really be dropped, no more need to load them
List<ComponentDto> baseModules = dbClient.componentDao().selectEnabledModulesFromProjectKey(dbSession, root.getDbKey());
Map<String, ComponentDto> baseModulesByKey = baseModules.stream().collect(Collectors.toMap(ComponentDto::getDbKey, x -> x));
ValidateProjectsVisitor visitor = new ValidateProjectsVisitor(dbSession, dbClient.componentDao(), baseModulesByKey);
new DepthTraversalTypeAwareCrawler(visitor).visit(root);
if (!visitor.validationMessages.isEmpty()) {
throw MessageException.of("Validation of project failed:\n o " + MESSAGES_JOINER.join(visitor.validationMessages));
}
}
}
Aggregations