예제 #1
0
        private BuildTree CalculateDependencies(IPackageTree packageTree, BuildTree currentTree)
        {
            if (currentTree == null)
            {
                currentTree = new BuildTree(packageTree);
            }
            else
            {
                if (HasACircularDependency(currentTree, packageTree))
                {
                    throw new CircularDependencyException(packageTree.Name);
                }

                InsertDependenciesBeforeParent(currentTree, packageTree);
            }

            var buildMetaData = packageTree.GetBuildMetaData(packageTree.Name);

            var buildEngine = buildMetaData.BuildEngine;

            var dependencies = buildEngine.Dependencies;

            foreach (var dependency in dependencies)
            {
                var package = packageTree.RetrievePackage(dependency);

                if (package is NullPackageTree)
                    throw new UnknownInstallPackageException(string.Format("No package definition exists for dependent package {0}, which is required by {1}.", dependency.PackageName, packageTree.FullName));

                CalculateDependencies(package, currentTree);
            }

            return currentTree;
        }
예제 #2
0
        private BuildTree CalculateDependencies(IPackageTree packageTree, BuildTree currentTree)
        {
            if (currentTree == null)
            {
                currentTree = new BuildTree(packageTree);
            }
            else
            {
                if (HasACircularDependency(currentTree, packageTree))
                {
                    throw new CircularDependencyException(packageTree.Name);
                }

                InsertDependenciesBeforeParent(currentTree, packageTree);
            }

            var buildMetaData = packageTree.GetBuildMetaData(packageTree.Name);

            var buildEngine = buildMetaData.BuildEngine;

            var dependencies = buildEngine.Dependencies;

            foreach (var dependency in dependencies)
            {
                var package = packageTree.RetrievePackage(dependency);

                if (package is NullPackageTree)
                {
                    throw new UnknownInstallPackageException(string.Format("No package definition exists for dependent package {0}, which is required by {1}.", dependency.PackageName, packageTree.FullName));
                }

                CalculateDependencies(package, currentTree);
            }

            return(currentTree);
        }
예제 #3
0
 public BuildTree(IPackageTree node, IList<BuildTree> children, BuildTree parent)
 {
     Parent = parent;
     Children = children;
     Node = node;
 }
예제 #4
0
 public BuildTree(IPackageTree node, BuildTree parent)
     : this(node, new List<BuildTree>(), parent)
 {
 }
예제 #5
0
 private void CalculateDependencies(IPackageTree packageTree)
 {
     buildTree = CalculateDependencies(packageTree, null);
 }
예제 #6
0
 private void InsertDependenciesBeforeParent(BuildTree tree, IPackageTree packageTree)
 {
     tree.AddChild(packageTree);
 }
예제 #7
0
 private bool HasACircularDependency(BuildTree tree, IPackageTree packageTree)
 {
     return tree.GetAncestors().Contains(packageTree);
 }
예제 #8
0
 private bool HasACircularDependency(BuildTree tree, IPackageTree packageTree)
 {
     return(tree.GetAncestors().Contains(packageTree));
 }
예제 #9
0
 private void InsertDependenciesBeforeParent(BuildTree tree, IPackageTree packageTree)
 {
     tree.AddChild(packageTree);
 }
예제 #10
0
 private void CalculateDependencies(IPackageTree packageTree)
 {
     buildTree = CalculateDependencies(packageTree, null);
 }
예제 #11
0
 public BuildTree(IPackageTree node, IList <BuildTree> children, BuildTree parent)
 {
     Parent   = parent;
     Children = children;
     Node     = node;
 }
예제 #12
0
 public BuildTree(IPackageTree node, BuildTree parent)
     : this(node, new List <BuildTree>(), parent)
 {
 }