Exemple #1
0
        private static HashSet <VersionedDependency> CollectTransitiveDependencies(DependencyGraphObject current, List <string> transitiveDependencies, ref HashSet <VersionedDependency> collected)
        {
            foreach (string transitiveDependency in transitiveDependencies)
            {
                CollectTransitiveDependencies(current, transitiveDependency, ref collected);
            }

            return(collected);
        }
        public DependencyGraphManager()
        {
            if (!File.Exists (persistencePath)) {
                // Although a missing dependency graph is unusual, we hope that it
                // will be renewed next time we check for updates.
                Utils.Warn ("Couldn't load dependency graph ({0})", persistencePath);
                return;
            }

            current = DependencyGraphObject.FromJson (File.ReadAllText (persistencePath));
        }
Exemple #3
0
        public DependencyGraphManager()
        {
            if (!File.Exists(persistencePath))
            {
                // Although a missing dependency graph is unusual, we hope that it
                // will be renewed next time we check for updates.
                Utils.Warn("Couldn't load dependency graph ({0})", persistencePath);
                return;
            }

            current = DependencyGraphObject.FromJson(File.ReadAllText(persistencePath));
        }
Exemple #4
0
        private static HashSet <VersionedDependency> Collect(DependencyGraphObject current, string kit, ref HashSet <VersionedDependency> collected)
        {
            KitsObject kitObject = current.Dependencies.Kits.Find(
                k => k.Name.Equals(kit, System.StringComparison.OrdinalIgnoreCase)
                );

            if (kitObject == null)
            {
                return(collected);
            }

            return(CollectTransitiveDependencies(current, kitObject.DependsOn, ref collected));
        }
Exemple #5
0
        private static void CollectTransitiveDependencies(DependencyGraphObject current, string transitiveDependency, ref HashSet <VersionedDependency> collected)
        {
            TransitiveDependenciesObject dependency = current.Dependencies.TransitiveDependnecies.Find(
                k => k.Name.Equals(transitiveDependency, System.StringComparison.OrdinalIgnoreCase)
                );

            if (dependency == null)
            {
                Utils.Warn("Failed to gather dependency information for {0}; is there a type-o in the Dependency Graph?", transitiveDependency);
                return;
            }

            collected.Add(new VersionedDependency {
                Name    = dependency.Name,
                Version = dependency.Version
            });
            CollectTransitiveDependencies(current, dependency.DependsOn, ref collected);
        }
		public bool Manage(string json)
		{
			if (!System.Threading.Monitor.TryEnter (monitorObj, ManageTimeout)) {
				Utils.Log ("Plugin or kit update is in progress, delaying managing new dependency graph");
				return false;
			}

			try {
				DependencyGraphObject latest = DependencyGraphObject.FromJson (json);

				if (current == null || IsNewer (current.Version, latest.Version)) {
					File.WriteAllText (persistencePath, json);
					current = latest;
					Utils.Log ("Updated dependency graph to {0}", latest.Version);
				}
			} finally {
				System.Threading.Monitor.Exit (monitorObj);
			}

			return true;
		}
Exemple #7
0
        public bool Manage(string json)
        {
            if (!System.Threading.Monitor.TryEnter(monitorObj, ManageTimeout))
            {
                Utils.Log("Plugin or kit update is in progress, delaying managing new dependency graph");
                return(false);
            }

            try {
                DependencyGraphObject latest = DependencyGraphObject.FromJson(json);

                if (current == null || IsNewer(current.Version, latest.Version))
                {
                    File.WriteAllText(persistencePath, json);
                    current = latest;
                    Utils.Log("Updated dependency graph to {0}", latest.Version);
                }
            } finally {
                System.Threading.Monitor.Exit(monitorObj);
            }

            return(true);
        }
 public static HashSet<VersionedDependency> TransitiveDependencyChainFor(DependencyGraphObject current, string kit)
 {
     HashSet<VersionedDependency> dependencies = new HashSet<VersionedDependency> ();
     return current != null ? Collect (current, kit, ref dependencies) : dependencies;
 }
        private static void CollectTransitiveDependencies(DependencyGraphObject current, string transitiveDependency, ref HashSet<VersionedDependency> collected)
        {
            TransitiveDependenciesObject dependency = current.Dependencies.TransitiveDependnecies.Find (
                k => k.Name.Equals (transitiveDependency, System.StringComparison.OrdinalIgnoreCase)
            );

            if (dependency == null) {
                Utils.Warn ("Failed to gather dependency information for {0}; is there a type-o in the Dependency Graph?", transitiveDependency);
                return;
            }

            collected.Add (new VersionedDependency {
                Name = dependency.Name,
                Version = dependency.Version
            });
            CollectTransitiveDependencies (current, dependency.DependsOn, ref collected);
        }
        private static HashSet<VersionedDependency> CollectTransitiveDependencies(DependencyGraphObject current, List<string> transitiveDependencies, ref HashSet<VersionedDependency> collected)
        {
            foreach (string transitiveDependency in transitiveDependencies) {
                CollectTransitiveDependencies (current, transitiveDependency, ref collected);
            }

            return collected;
        }
        private static HashSet<VersionedDependency> Collect(DependencyGraphObject current, string kit, ref HashSet<VersionedDependency> collected)
        {
            KitsObject kitObject = current.Dependencies.Kits.Find (
                k => k.Name.Equals (kit, System.StringComparison.OrdinalIgnoreCase)
            );

            if (kitObject == null) {
                return collected;
            }

            return CollectTransitiveDependencies (current, kitObject.DependsOn, ref collected);
        }
 public DependencyGraphResolver(DependencyGraphObject dependencyGraph)
 {
     this.dependencyGraph = dependencyGraph;
 }
 public DependencyGraphResolver(DependencyGraphObject dependencyGraph)
 {
     this.dependencyGraph = dependencyGraph;
 }
Exemple #14
0
        public static HashSet <VersionedDependency> TransitiveDependencyChainFor(DependencyGraphObject current, string kit)
        {
            HashSet <VersionedDependency> dependencies = new HashSet <VersionedDependency> ();

            return(current != null?Collect(current, kit, ref dependencies) : dependencies);
        }