import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.apache.commons.lang.CharUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.Plugin;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
import org.sonar.core.platform.PluginInfo;
import org.sonar.core.plugins.RemotePlugin;
import org.sonar.core.plugins.RemotePluginFile;
import org.sonar.home.cache.FileCache;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* Downloads the plugins installed on server and stores them in a local user cache
* (see {@link FileCacheProvider}).
@Override
public Map<String, PluginInfo> installRemotes() {
Map<String, PluginInfo> infosByKey = new HashMap<>();
- for (RemotePlugin remotePlugin : listRemotePlugins()) {
+ List<RemotePlugin> remotePlugins = listRemotePlugins();
+ 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;
}
@VisibleForTesting
List<RemotePlugin> listRemotePlugins() {
try {
- LOG.debug("Download index of plugins");
+ Profiler profiler = Profiler.create(LOG).startInfo("Load plugins index");
String indexContent = server.request(PLUGINS_INDEX_URL);
+ profiler.stopInfo();
String[] rows = StringUtils.split(indexContent, CharUtils.LF);
List<RemotePlugin> result = Lists.newArrayList();
for (String row : rows) {
return result;
} catch (Exception e) {
- throw new IllegalStateException("Fail to download list of plugins: " + PLUGINS_INDEX_URL, e);
+ throw new IllegalStateException("Fail to load plugin index: " + PLUGINS_INDEX_URL, e);
}
}
}
package org.sonar.batch.scan;
import com.google.common.collect.Lists;
-import org.slf4j.LoggerFactory;
+import java.util.List;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.config.Settings;
import org.sonar.api.utils.MessageException;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
import org.sonar.batch.bootstrap.DefaultAnalysisMode;
import org.sonar.batch.bootstrap.GlobalSettings;
import org.sonar.batch.protocol.input.ProjectRepositories;
-import java.util.List;
-
/**
* @since 2.12
*/
public class ModuleSettings extends Settings {
+ private static final Logger LOG = Loggers.get(ModuleSettings.class);
+
private final ProjectRepositories projectReferentials;
private DefaultAnalysisMode analysisMode;
this.analysisMode = analysisMode;
getEncryption().setPathToSecretKey(batchSettings.getString(CoreProperties.ENCRYPTION_SECRET_KEY_PATH));
- LoggerFactory.getLogger(ModuleSettings.class).info("Load module settings");
+ Profiler profiler = Profiler.create(LOG).startInfo("Load module settings");
init(moduleDefinition, batchSettings);
+ profiler.stopDebug();
}
private ModuleSettings init(ProjectDefinition moduleDefinition, GlobalSettings batchSettings) {
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
-import org.apache.commons.io.filefilter.AndFileFilter;
-import org.apache.commons.io.filefilter.FileFileFilter;
-import org.apache.commons.io.filefilter.IOFileFilter;
-import org.apache.commons.io.filefilter.WildcardFileFilter;
-import org.apache.commons.lang.ObjectUtils;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonar.api.CoreProperties;
-import org.sonar.api.batch.bootstrap.ProjectDefinition;
-import org.sonar.api.batch.bootstrap.ProjectReactor;
-import org.sonar.batch.bootstrap.AnalysisProperties;
-import org.sonar.batch.util.BatchUtils;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+import org.apache.commons.io.filefilter.AndFileFilter;
+import org.apache.commons.io.filefilter.FileFileFilter;
+import org.apache.commons.io.filefilter.IOFileFilter;
+import org.apache.commons.io.filefilter.WildcardFileFilter;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang.StringUtils;
+import org.sonar.api.CoreProperties;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.utils.log.Profiler;
+import org.sonar.batch.bootstrap.AnalysisProperties;
+import org.sonar.batch.util.BatchUtils;
/**
* Class that creates a project definition based on a set of properties.
private static final String INVALID_VALUE_OF_X_FOR_Y = "Invalid value of {0} for {1}";
- private static final Logger LOG = LoggerFactory.getLogger(ProjectReactorBuilder.class);
+ private static final Logger LOG = Loggers.get(ProjectReactorBuilder.class);
/**
* @since 4.1 but not yet exposed in {@link CoreProperties}
}
public ProjectReactor execute() {
+ Profiler profiler = Profiler.create(LOG).startInfo("Process project properties");
Map<String, Map<String, String>> propertiesByModuleId = extractPropertiesByModule("", taskProps.properties());
ProjectDefinition rootProject = defineRootProject(propertiesByModuleId.get(""), null);
rootProjectWorkDir = rootProject.getWorkDir();
for (Map.Entry<String, String> entry : propertiesByModuleId.get("").entrySet()) {
taskProps.properties().put((String) entry.getKey(), (String) entry.getValue());
}
+ profiler.stopInfo();
return new ProjectReactor(rootProject);
}