예제 #1
0
                public override void BeginConfiguration(Configuration configuration)
                {
                    if (_treeView.InvokeRequired)
                    {
                        _treeView.Invoke(new OneParamDelegate<Configuration>(BeginConfiguration), configuration);
                        return;
                    }

                    _treeView.Nodes.Add("Configuration: " + configuration.Name);
                }
예제 #2
0
        public int Run(Configuration configuration)
        {
            bool success = true;

            _isRunning = true;

            Log(LogLevel.Info, string.Format("Tada {0}", Assembly.GetExecutingAssembly().GetName().Version));
            Log(LogLevel.Info, string.Format("Starting the build at {0}...", _start));

            try
            {
                Initialize();

                if (configuration == null)
                {
                    foreach (Configuration projectConfiguration in _project.Configurations)
                    {
                        if (string.IsNullOrEmpty(_options.ConfigurationName) || configuration.Name.Equals(_options.ConfigurationName))
                        {
                            configuration = projectConfiguration;
                            break;
                        }
                    }
                }
                if (configuration == null)
                {
                    return 4;
                }

                // options
                _project.Initialize();

                foreach (var property in _options.ProjectProperties)
                {
                    SetProperty(_project, property.Key, property.Value);
                }
                foreach (var property in _options.ConfigurationProperties)
                {
                    SetProperty(configuration, property.Key, property.Value);
                }

                if (_options.DisabledTargets != null)
                {
                    DisableTargets(configuration, _options.DisabledTargets);
                }

                _project.Execute();

                if (_loggers.Count == 0)
                {
                    AddLogger(new ConsoleLogger());
                }

                _mainThread.Enqueue(configuration);

                while (!_finished)
                {
                    Sleep();

                    lock (_threadsSyncRoot)
                    {
                        _finished = _sleepingThreadsCount == _threads.Count;
                    }
                }

                lock (_threadsSyncRoot)
                {
                    foreach (BuildThread thread in _threads)
                    {
                        success = success && thread.Success;
                    }
                }

                if (!success)
                {
                    return 1;
                }
            }
            finally
            {
                DateTime end = DateTime.Now;

                Log(LogLevel.Info, string.Format("Finishing the build at {0}, total time: {1}...", end, end - _start));

                Finish(success);

                _isRunning = false;
            }

            return 0;
        }