Search in sources :

Example 6 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ServerIssueRepository method load.

public void load() {
    Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
    this.issuesCache = caches.createCache("previousIssues");
    caches.registerValueCoder(ServerIssue.class, new ServerIssueValueCoder());
    previousIssuesLoader.load(reactor.getRoot().getKeyWithBranch(), new SaveIssueConsumer());
    profiler.stopInfo();
}
Also used : Profiler(org.sonar.api.utils.log.Profiler)

Example 7 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ScannerPluginInstaller method loadPlugins.

private Map<String, PluginInfo> loadPlugins(List<RemotePlugin> remotePlugins) {
    Map<String, PluginInfo> infosByKey = new HashMap<>(remotePlugins.size());
    Profiler profiler = Profiler.create(LOG).startDebug("Load plugins");
    for (RemotePlugin remotePlugin : remotePlugins) {
        if (pluginPredicate.apply(remotePlugin.getKey())) {
            File jarFile = download(remotePlugin);
            PluginInfo info = PluginInfo.create(jarFile);
            infosByKey.put(info.getKey(), info);
        }
    }
    profiler.stopDebug();
    return infosByKey;
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) HashMap(java.util.HashMap) RemotePlugin(org.sonar.core.platform.RemotePlugin) PluginInfo(org.sonar.core.platform.PluginInfo) RemotePluginFile(org.sonar.core.platform.RemotePluginFile) File(java.io.File)

Example 8 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class RulesProvider method load.

private static Rules load(RulesLoader ref) {
    Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
    List<Rule> loadedRules = ref.load();
    RulesBuilder builder = new RulesBuilder();
    for (Rule r : loadedRules) {
        NewRule newRule = builder.add(RuleKey.of(r.getRepository(), r.getKey()));
        newRule.setName(r.getName());
        newRule.setInternalKey(r.getInternalKey());
    }
    profiler.stopInfo();
    return builder.build();
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) NewRule(org.sonar.api.batch.rule.internal.NewRule) Rule(org.sonarqube.ws.Rules.ListResponse.Rule) RulesBuilder(org.sonar.api.batch.rule.internal.RulesBuilder) NewRule(org.sonar.api.batch.rule.internal.NewRule)

Example 9 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ProjectBuildersExecutor method execute.

public void execute(ProjectReactor reactor) {
    if (projectBuilders.length > 0) {
        Profiler profiler = Profiler.create(LOG).startInfo("Execute project builders");
        ProjectBuilderContext context = new ProjectBuilderContext(reactor);
        for (ProjectBuilder projectBuilder : projectBuilders) {
            try {
                projectBuilder.build(context);
            } catch (Exception e) {
                throw MessageException.of("Failed to execute project builder: " + getDescription(projectBuilder), e);
            }
        }
        profiler.stopInfo();
    }
}
Also used : ProjectBuilderContext(org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext) Profiler(org.sonar.api.utils.log.Profiler) ProjectBuilder(org.sonar.api.batch.bootstrap.ProjectBuilder) MessageException(org.sonar.api.utils.MessageException)

Example 10 with Profiler

use of org.sonar.api.utils.log.Profiler in project sonarqube by SonarSource.

the class ProjectReactorBuilder method execute.

public ProjectReactor execute() {
    Profiler profiler = Profiler.create(LOG).startInfo("Process project properties");
    new DroppedPropertyChecker(analysisProps.properties(), DROPPED_PROPERTIES).checkDroppedProperties();
    Map<String, Map<String, String>> propertiesByModuleIdPath = new HashMap<>();
    extractPropertiesByModule(propertiesByModuleIdPath, "", "", analysisProps.properties());
    ProjectDefinition rootProject = defineRootProject(propertiesByModuleIdPath.get(""), null);
    rootProjectWorkDir = rootProject.getWorkDir();
    defineChildren(rootProject, propertiesByModuleIdPath, "");
    cleanAndCheckProjectDefinitions(rootProject);
    // Since task properties are now empty we should add root module properties
    analysisProps.properties().putAll(propertiesByModuleIdPath.get(""));
    profiler.stopDebug();
    return new ProjectReactor(rootProject);
}
Also used : Profiler(org.sonar.api.utils.log.Profiler) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ProjectReactor(org.sonar.api.batch.bootstrap.ProjectReactor) DroppedPropertyChecker(org.sonar.scanner.bootstrap.DroppedPropertyChecker) ProjectDefinition(org.sonar.api.batch.bootstrap.ProjectDefinition)

Aggregations

Profiler (org.sonar.api.utils.log.Profiler)24 DbSession (org.sonar.db.DbSession)4 IOException (java.io.IOException)3 GetRequest (org.sonarqube.ws.client.GetRequest)3 Reader (java.io.Reader)2 HashMap (java.util.HashMap)2 PrivilegedPluginBridge (org.sonar.plugin.PrivilegedPluginBridge)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 OptInCaching (org.picocontainer.behaviors.OptInCaching)1 ReflectionLifecycleStrategy (org.picocontainer.lifecycle.ReflectionLifecycleStrategy)1 NullComponentMonitor (org.picocontainer.monitors.NullComponentMonitor)1 Initializer (org.sonar.api.batch.Initializer)1 ProjectBuilder (org.sonar.api.batch.bootstrap.ProjectBuilder)1 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)1 ProjectReactor (org.sonar.api.batch.bootstrap.ProjectReactor)1 ProjectBuilderContext (org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext)1