private void addScannerExtensions() { getComponentByType(CoreExtensionsInstaller.class) .install(this, noExtensionFilter(), extension -> getScannerProjectExtensionsFilter().accept(extension)); getComponentByType(ExtensionInstaller.class) .install(this, getScannerProjectExtensionsFilter()); }
@Override protected void doAfterStart() { installPlugins(); loadCoreExtensions(); long startTime = System.currentTimeMillis(); String taskKey = StringUtils.defaultIfEmpty(scannerProperties.get(CoreProperties.TASK), CoreProperties.SCAN_TASK); if (taskKey.equals("views")) { throw MessageException.of("The task 'views' was removed with SonarQube 7.1. " + "You can safely remove this call since portfolios and applications are automatically re-calculated."); } else if (!taskKey.equals(CoreProperties.SCAN_TASK)) { throw MessageException.of("Tasks support was removed in SonarQube 7.6."); } new ProjectScanContainer(this).execute(); LOG.info("Analysis total time: {}", formatTime(System.currentTimeMillis() - startTime)); }
private void addIssueTrackingComponents() { add( LocalIssueTracking.class, ServerIssueRepository.class); addIfMissing(DefaultServerIssuesLoader.class, ServerIssuesLoader.class); addIfMissing(DefaultServerLineHashesLoader.class, ServerLineHashesLoader.class); }
@Override protected void doBeforeStart() { addScannerComponents(); addScannerExtensions(); ProjectLock lock = getComponentByType(ProjectLock.class); lock.tryLock(); getComponentByType(WorkDirectoriesInitializer.class).execute(); if (!isIssuesMode()) { addReportPublishSteps(); } else if (isTherePreviousAnalysis()) { addIssueTrackingComponents(); } }
@Override protected void doAfterStart() { GlobalAnalysisMode analysisMode = getComponentByType(GlobalAnalysisMode.class); InputModuleHierarchy tree = getComponentByType(InputModuleHierarchy.class); ScanProperties properties = getComponentByType(ScanProperties.class); properties.validate(); BranchConfiguration branchConfig = getComponentByType(BranchConfiguration.class); if (branchConfig.branchType() == BranchType.PULL_REQUEST) { LOG.info("Pull request {} for merge into {} from {}", branchConfig.pullRequestKey(), pullRequestBaseToDisplayName(branchConfig.targetScmBranch()), branchConfig.branchName()); } else if (branchConfig.branchName() != null) { LOG.info("Branch name: {}, type: {}", branchConfig.branchName(), branchTypeToDisplayName(branchConfig.branchType())); getComponentByType(ProjectFileIndexer.class).index(); getComponentByType(QProfileVerifier.class).execute(); scanRecursively(tree, tree.root()); getComponentByType(ProjectSensorsExecutor.class).execute(); getComponentByType(ScmPublisher.class).publish(); getComponentByType(IssueTransition.class).execute(); getComponentByType(JSONReport.class).execute(); LOG.info("ANALYSIS SUCCESSFUL"); } else { getComponentByType(CpdExecutor.class).execute(); getComponentByType(ReportPublisher.class).execute();
@Test public void should_add_only_batch_extensions() { ExtensionMatcher filter = ProjectScanContainer.getScannerProjectExtensionsFilter(); assertThat(filter.accept(new MyBatchExtension())).isTrue(); assertThat(filter.accept(MyBatchExtension.class)).isTrue(); assertThat(filter.accept(new MyProjectExtension())).isFalse(); assertThat(filter.accept(MyProjectExtension.class)).isFalse(); assertThat(filter.accept(new MyServerExtension())).isFalse(); assertThat(filter.accept(MyServerExtension.class)).isFalse(); assertThat(filter.accept(new MyTaskExtension())).isFalse(); assertThat(filter.accept(MyTaskExtension.class)).isFalse(); }
private void addReportPublishSteps() { add( ComponentsPublisher.class, MeasuresPublisher.class, CoveragePublisher.class, SourcePublisher.class, ChangedLinesPublisher.class); }
@Override protected void doBeforeStart() { addScannerComponents(); addScannerExtensions(); ProjectLock lock = getComponentByType(ProjectLock.class); lock.tryLock(); getComponentByType(WorkDirectoriesInitializer.class).execute(); if (!isIssuesMode()) { addReportPublishSteps(); } else if (isTherePreviousAnalysis()) { addIssueTrackingComponents(); } }
@Override protected void doAfterStart() { GlobalAnalysisMode analysisMode = getComponentByType(GlobalAnalysisMode.class); InputModuleHierarchy tree = getComponentByType(InputModuleHierarchy.class); ScanProperties properties = getComponentByType(ScanProperties.class); properties.validate(); BranchConfiguration branchConfig = getComponentByType(BranchConfiguration.class); if (branchConfig.branchType() == BranchType.PULL_REQUEST) { LOG.info("Pull request {} for merge into {} from {}", branchConfig.pullRequestKey(), pullRequestBaseToDisplayName(branchConfig.targetScmBranch()), branchConfig.branchName()); } else if (branchConfig.branchName() != null) { LOG.info("Branch name: {}, type: {}", branchConfig.branchName(), branchTypeToDisplayName(branchConfig.branchType())); getComponentByType(ProjectFileIndexer.class).index(); getComponentByType(QProfileVerifier.class).execute(); scanRecursively(tree, tree.root()); getComponentByType(ProjectSensorsExecutor.class).execute(); getComponentByType(ScmPublisher.class).publish(); getComponentByType(IssueTransition.class).execute(); getComponentByType(JSONReport.class).execute(); LOG.info("ANALYSIS SUCCESSFUL"); } else { getComponentByType(CpdExecutor.class).execute(); getComponentByType(ReportPublisher.class).execute();
private void addReportPublishSteps() { add( ComponentsPublisher.class, MeasuresPublisher.class, CoveragePublisher.class, SourcePublisher.class, ChangedLinesPublisher.class); }
private void addScannerComponents() { add( ProjectReactorBuilder.class, ScanProperties.class, addIfMissing(DefaultRulesLoader.class, RulesLoader.class); addIfMissing(DefaultActiveRulesLoader.class, ActiveRulesLoader.class); addIfMissing(DefaultQualityProfileLoader.class, QualityProfileLoader.class); addIfMissing(DefaultProjectRepositoriesLoader.class, ProjectRepositoriesLoader.class);
private void addScannerExtensions() { getComponentByType(CoreExtensionsInstaller.class) .install(this, noExtensionFilter(), extension -> getScannerProjectExtensionsFilter().accept(extension)); getComponentByType(ExtensionInstaller.class) .install(this, getScannerProjectExtensionsFilter()); }
@Override protected void doAfterStart() { installPlugins(); loadCoreExtensions(); long startTime = System.currentTimeMillis(); String taskKey = StringUtils.defaultIfEmpty(scannerProperties.get(CoreProperties.TASK), CoreProperties.SCAN_TASK); if (taskKey.equals("views")) { throw MessageException.of("The task 'views' was removed with SonarQube 7.1. " + "You can safely remove this call since portfolios and applications are automatically re-calculated."); } else if (!taskKey.equals(CoreProperties.SCAN_TASK)) { throw MessageException.of("Tasks support was removed in SonarQube 7.6."); } new ProjectScanContainer(this).execute(); LOG.info("Analysis total time: {}", formatTime(System.currentTimeMillis() - startTime)); }
private void addIssueTrackingComponents() { add( LocalIssueTracking.class, ServerIssueRepository.class); addIfMissing(DefaultServerIssuesLoader.class, ServerIssuesLoader.class); addIfMissing(DefaultServerLineHashesLoader.class, ServerLineHashesLoader.class); }
private void addScannerComponents() { add( ProjectReactorBuilder.class, ScanProperties.class, addIfMissing(DefaultRulesLoader.class, RulesLoader.class); addIfMissing(DefaultActiveRulesLoader.class, ActiveRulesLoader.class); addIfMissing(DefaultQualityProfileLoader.class, QualityProfileLoader.class); addIfMissing(DefaultProjectRepositoriesLoader.class, ProjectRepositoriesLoader.class);