예제 #1
0
        public BuildNode(ProjectDependencyGraph graph,
                         TaskEngine.TaskEngine taskEngine,
                         IBuildLog buildLog,
                         string name,
                         string target)
        {
            if (graph == null)
            {
                throw new ArgumentNullException("graph");
            }
            if (taskEngine == null)
            {
                throw new ArgumentNullException("taskEngine");
            }
            if (buildLog == null)
            {
                throw new ArgumentNullException("buildLog");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("A non-empty/whitespace name must be given", "name");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            _graph      = graph;
            _taskEngine = taskEngine;
            _buildLog   = buildLog;
            _name       = name;
            _target     = target;
            _thread     = new Thread(Run)
            {
                IsBackground = true,
                Name         = name
            };
            _thread.Start();
        }
예제 #2
0
        public BuildEngine(Arguments arguments, IFileSystem fileSystem)
        {
            if (arguments == null)
            {
                throw new ArgumentNullException("arguments");
            }

            if (arguments.MaxCpuCount <= 0 || arguments.MaxCpuCount > 1024)
            {
                throw new BuildException(
                          string.Format(
                              "error MSB1032: Maximum CPU count is not valid. Value must be an integer greater than zero and nore more than 1024.\r\nSwitch: {0}",
                              arguments.MaxCpuCount));
            }

            _fileSystem = fileSystem;
            var buildlogStream = _fileSystem.OpenWrite("buildlog.txt");

            Log = new BuildLog(arguments, buildlogStream, true);
            _csharpProjectParser = new ProjectParser(_fileSystem);
            _solutionParser      = new SolutionParser(_csharpProjectParser);
            _expressionEngine    = new ExpressionEngine.ExpressionEngine(fileSystem);
            _taskEngine          = new TaskEngine.TaskEngine(_expressionEngine, fileSystem);
            _arguments           = arguments;
            if (_arguments.Targets.Count == 0)
            {
                _arguments.Targets.Add(Targets.Build);
            }
            else
            {
                _arguments.Targets.Sort(new TargetComparer());
            }

            _environment = new BuildEnvironment(name: "Build Engine Environment");
            foreach (var property in arguments.Properties)
            {
                _environment.Properties.Add(property.Name, property.Value);
            }

            _buildScript = LoadBuildScript();
        }