private static async Task InitializePlugin( ProjectCacheDescriptor pluginDescriptor, CancellationToken cancellationToken, Func <PluginLoggerBase> loggerFactory, ProjectCachePluginBase plugin ) { var logger = loggerFactory(); try { await plugin.BeginBuildAsync( new CacheContext( pluginDescriptor.PluginSettings, new DefaultMSBuildFileSystem(), pluginDescriptor.ProjectGraph, pluginDescriptor.EntryPoints), // TODO: Detect verbosity from logging service. logger, cancellationToken); } catch (Exception e) { HandlePluginException(e, nameof(ProjectCachePluginBase.BeginBuildAsync)); } if (logger.HasLoggedErrors) { ProjectCacheException.ThrowForErrorLoggedInsideTheProjectCache("ProjectCacheInitializationFailed"); } }
private ProjectCacheService( ProjectCachePluginBase projectCachePlugin, BuildManager buildManager, Func <PluginLoggerBase> loggerFactory, ProjectCacheDescriptor projectCacheDescriptor, CancellationToken cancellationToken ) { _projectCachePlugin = projectCachePlugin; _buildManager = buildManager; _loggerFactory = loggerFactory; _projectCacheDescriptor = projectCacheDescriptor; _cancellationToken = cancellationToken; }
private ProjectCacheService( ProjectCachePluginBase projectCachePlugin, BuildManager buildManager, ILoggingService loggingService, ProjectCacheDescriptor projectCacheDescriptor, CancellationToken cancellationToken ) { _projectCachePlugin = projectCachePlugin; _buildManager = buildManager; _loggingService = loggingService; _projectCacheDescriptor = projectCacheDescriptor; _cancellationToken = cancellationToken; }
private static (ProjectCachePluginBase PluginInstance, string PluginTypeName) GetPluginInstance(ProjectCacheDescriptor pluginDescriptor) { if (pluginDescriptor.PluginInstance != null) { return(pluginDescriptor.PluginInstance, pluginDescriptor.PluginInstance.GetType().Name); } if (pluginDescriptor.PluginAssemblyPath != null) { MSBuildEventSource.Log.ProjectCacheCreatePluginInstanceStart(pluginDescriptor.PluginAssemblyPath); Type pluginType = GetTypeFromAssemblyPath(pluginDescriptor.PluginAssemblyPath); ProjectCachePluginBase pluginInstance = GetPluginInstanceFromType(pluginType); MSBuildEventSource.Log.ProjectCacheCreatePluginInstanceStop(pluginDescriptor.PluginAssemblyPath, pluginType.Name); return(pluginInstance, pluginType.Name); } ErrorUtilities.ThrowInternalErrorUnreachable(); return(null !, null !); // Unreachable }