Exemplo n.º 1
0
        public void Add(Project project, BuildEnvironment environment)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (project.Filename == null)
            {
                throw new ArgumentNullException("project.Filename");
            }
            if (!Path.IsPathRooted(project.Filename))
            {
                throw new ArgumentException("project");
            }
            if (environment == null)
            {
                throw new ArgumentNullException("environment");
            }

            var env = new ProjectAndEnvironment
            {
                Project     = project,
                Environment = environment
            };

            _all.Add(project.Filename, env);
            _todo.Add(project.Filename, env);
            var dependencies = new HashSet <Project>();

            _dependencies.Add(project, dependencies);
            ++_projectCount;
        }
Exemplo n.º 2
0
        public bool TryGetNextProject(out Project project, out BuildEnvironment environment)
        {
            lock (_syncRoot)
            {
                // The goal is simple: Find the first project that doesn't have any
                // unfinished dependencies anymore.
                foreach (var pair in _todo.Values)
                {
                    var possibleProject = pair.Project;
                    var dependencies    = _dependencies[possibleProject];
                    if (dependencies.Count == 0)
                    {
                        var fileName = possibleProject.Filename;
                        project     = possibleProject;
                        environment = pair.Environment;
                        _todo.Remove(fileName);
                        return(true);
                    }
                }

                project     = null;
                environment = null;
                return(false);
            }
        }
Exemplo n.º 3
0
 public BuildEnvironment(BuildEnvironment parent = null, string name = null)
 {
     _name       = name;
     _parent     = parent;
     _properties = new EnvironmentProperties(
         _parent?._properties
         );
     _output = new EnvironmentProperties(
         _parent?.Output
         );
     _items = new EnvironmentItemLists(
         _parent?._items
         );
 }