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; }
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); }
public BuildTree(IPackageTree node, IList<BuildTree> children, BuildTree parent) { Parent = parent; Children = children; Node = node; }
public BuildTree(IPackageTree node, BuildTree parent) : this(node, new List<BuildTree>(), parent) { }
private void CalculateDependencies(IPackageTree packageTree) { buildTree = CalculateDependencies(packageTree, null); }
private void InsertDependenciesBeforeParent(BuildTree tree, IPackageTree packageTree) { tree.AddChild(packageTree); }
private bool HasACircularDependency(BuildTree tree, IPackageTree packageTree) { return tree.GetAncestors().Contains(packageTree); }
private bool HasACircularDependency(BuildTree tree, IPackageTree packageTree) { return(tree.GetAncestors().Contains(packageTree)); }
public BuildTree(IPackageTree node, IList <BuildTree> children, BuildTree parent) { Parent = parent; Children = children; Node = node; }
public BuildTree(IPackageTree node, BuildTree parent) : this(node, new List <BuildTree>(), parent) { }