Exemple #1
0
        void BeginBuildOperation(IEngineLogWriter logWriter, string binLogFilePath, MSBuildVerbosity verbosity, ProjectConfigurationInfo [] configurations)
        {
            // Start a new MSBuild build session, sending log to the provided writter

            RunSTA(delegate {
                BuildOperationStarted = true;
                // This property specifies the mapping between the solution configuration
                // and the project configurations
                engine.SetGlobalProperty("CurrentSolutionConfigurationContents", ProjectBuilder.GenerateSolutionConfigurationContents(configurations));
                BuildParameters parameters = new BuildParameters(engine);
                sessionLogWriter           = logWriter;
                loggerAdapter = new MSBuildLoggerAdapter(logWriter, verbosity);

                if (!string.IsNullOrEmpty(binLogFilePath))
                {
                    var binaryLogger = new BinaryLogger {
                        Parameters = binLogFilePath,
                        Verbosity  = LoggerVerbosity.Diagnostic
                    };

                    var loggers = new List <ILogger> (loggerAdapter.Loggers);
                    loggers.Add(binaryLogger);
                    parameters.Loggers = loggers;
                }
                else
                {
                    parameters.Loggers = loggerAdapter.Loggers;
                }

                BuildManager.DefaultBuildManager.BeginBuild(parameters);
            });
        }
Exemple #2
0
 internal RemoteProjectBuilder(string file, ProjectBuilder builder, RemoteBuildEngine engine)
 {
     this.file                = file;
     this.engine              = engine;
     this.builder             = builder;
     referenceCache           = new Dictionary <string, AssemblyReference[]> ();
     packageDependenciesCache = new Dictionary <string, PackageDependency[]> ();
 }
 public async Task UnloadProject(ProjectBuilder builder)
 {
     try {
         await connection.SendMessage(new UnloadProjectRequest { ProjectId = ((ProjectBuilder)builder).ProjectId });
     } catch (Exception ex) {
         LoggingService.LogError("Project unloading failed", ex);
         if (!await CheckDisconnected())
         {
             throw;
         }
     }
 }
Exemple #4
0
        internal async Task UnloadProject(RemoteProjectBuilder remoteBuilder, ProjectBuilder builder)
        {
            lock (remoteProjectBuilders)
                remoteProjectBuilders.Remove(remoteBuilder);

            try {
                await connection.SendMessage(new UnloadProjectRequest { ProjectId = ((ProjectBuilder)builder).ProjectId });
            } catch (Exception ex) {
                LoggingService.LogError("Project unloading failed", ex);
                if (!await CheckDisconnected())
                {
                    throw;
                }
            }
        }
        public BinaryMessage UnloadProject(UnloadProjectRequest msg)
        {
            ProjectBuilder pb = null;

            lock (projects) {
                if (projects.TryGetValue(msg.ProjectId, out pb))
                {
                    projects.Remove(msg.ProjectId);
                }
            }
            if (pb != null)
            {
                UnloadProject(pb);
            }
            return(msg.CreateResponse());
        }
        void BeginBuildOperation(IEngineLogWriter logWriter, MSBuildVerbosity verbosity, ProjectConfigurationInfo [] configurations)
        {
            // Start a new MSBuild build session, sending log to the provided writter

            RunSTA(delegate {
                BuildOperationStarted = true;
                // This property specifies the mapping between the solution configuration
                // and the project configurations
                engine.SetGlobalProperty("CurrentSolutionConfigurationContents", ProjectBuilder.GenerateSolutionConfigurationContents(configurations));
                BuildParameters parameters = new BuildParameters(engine);
                sessionLogWriter           = logWriter;
                loggerAdapter      = new MSBuildLoggerAdapter(logWriter, verbosity);
                parameters.Loggers = loggerAdapter.Loggers;
                BuildManager.DefaultBuildManager.BeginBuild(parameters);
            });
        }
Exemple #7
0
 public async void Dispose()
 {
     if (!MSBuildProjectService.ShutDown && engine != null)
     {
         try {
             if (builder != null)
             {
                 await engine.UnloadProject(this, builder).ConfigureAwait(false);
             }
             MSBuildProjectService.ReleaseProjectBuilder(engine);
         } catch {
             // Ignore
         }
         GC.SuppressFinalize(this);
         engine  = null;
         builder = null;
     }
 }
        public MSBuildLoggerAdapter(IEngineLogWriter logWriter, MSBuildVerbosity verbosity) : base(logWriter)
        {
            // LocalLogger will be used to collect build result information.
            // ConsoleLogger is used for the regular build output
            // TargetLogger collects and fordwards build events requested by the client

            var logger = new LocalLogger()
            {
                Adapter = this
            };

            if (logWriter != null)
            {
                var consoleLogger = new ConsoleLogger(ProjectBuilder.GetVerbosity(verbosity), LogWrite, null, null);
                eventsLogger = new TargetLogger(logWriter.RequiredEvents, LogEvent);
                loggers      = new ILogger [] { logger, consoleLogger, eventsLogger };
            }
            else
            {
                loggers = new ILogger [] { logger };
            }
        }
Exemple #9
0
 public void UnloadProject(ProjectBuilder pb)
 {
     pb.Dispose();
 }
Exemple #10
0
 public void UnloadProject(ProjectBuilder pb)
 {
     ((ProjectBuilder)pb).Dispose();
     RemotingServices.Disconnect((MarshalByRefObject)pb);
 }
 internal async Task Load()
 {
     builder = await engine.LoadProject(file).ConfigureAwait(false);
 }