bool IsDependencyCycle(BuildProvider buildProvider) { var cache = new Dictionary <BuildProvider, bool> (); cache.Add(buildProvider, true); return(IsDependencyCycle(cache, buildProvider.ExtractDependencies())); }
bool IsDependency(BuildProvider bp1, BuildProvider bp2) { IDictionary <string, bool> deps = bp1.ExtractDependencies(); if (deps == null) { return(false); } if (deps.ContainsKey(bp2.VirtualPath)) { return(true); } BuildProvider bp; // It won't loop forever as by the time this method is called, we are sure there are no cycles foreach (var dep in deps) { if (!buildProviders.TryGetValue(dep.Key, out bp)) { continue; } if (IsDependency(bp, bp2)) { return(true); } } return(false); }
bool IsDependencyCycle (BuildProvider buildProvider) { var cache = new Dictionary <BuildProvider, bool> (); cache.Add (buildProvider, true); return IsDependencyCycle (cache, buildProvider.ExtractDependencies ()); }
static void StoreInCache (BuildProvider bp, Assembly compiledAssembly, CompilerResults results) { string virtualPath = bp.VirtualPath; var item = new BuildManagerCacheItem (compiledAssembly, bp, results); if (buildCache.ContainsKey (virtualPath)) buildCache [virtualPath] = item; else buildCache.Add (virtualPath, item); HttpContext ctx = HttpContext.Current; HttpRequest req = ctx != null ? ctx.Request : null; CacheDependency dep; if (req != null) { IDictionary <string, bool> deps = bp.ExtractDependencies (); var files = new List <string> (); string physicalPath; physicalPath = req.MapPath (virtualPath); if (File.Exists (physicalPath)) files.Add (physicalPath); if (deps != null && deps.Count > 0) { foreach (var d in deps) { physicalPath = req.MapPath (d.Key); if (!File.Exists (physicalPath)) continue; if (!files.Contains (physicalPath)) files.Add (physicalPath); } } dep = new CacheDependency (files.ToArray ()); } else dep = null; HttpRuntime.InternalCache.Add (BUILD_MANAGER_VIRTUAL_PATH_CACHE_PREFIX + virtualPath, true, dep, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.High, new CacheItemRemovedCallback (OnVirtualPathChanged)); }
bool IsDependency (BuildProvider bp1, BuildProvider bp2) { IDictionary <string, bool> deps = bp1.ExtractDependencies (); if (deps == null) return false; if (deps.ContainsKey (bp2.VirtualPath)) return true; BuildProvider bp; // It won't loop forever as by the time this method is called, we are sure there are no cycles foreach (var dep in deps) { if (!buildProviders.TryGetValue (dep.Key, out bp)) continue; if (IsDependency (bp, bp2)) return true; } return false; }