GenerateProgramWrappers(ProduceWorkspace workspace) { Guard.NotNull(workspace, nameof(workspace)); var scripts = new HashSet <string>( workspace.FindRepositories() .Select(r => r.DotProducePath) .Where(p => File.Exists(p)) .Select(p => new DotProduce(p)) .Where(dp => dp != null) .SelectMany(dp => dp.Programs) .Select(path => Path.GetFileNameWithoutExtension(path)), StringComparer.OrdinalIgnoreCase); var orphans = Directory.GetFiles(workspace.GetBinDirectory()) .Where(file => !scripts.Contains(Path.GetFileNameWithoutExtension(file))) .ToList(); if (orphans.Count > 0) { using (LogicalOperation.Start("Deleting orphan program wrapper scripts")) { foreach (var file in orphans) { Trace.WriteLine(file); File.Delete(file); } } } }
RunCommands(ProduceWorkspace workspace, IList <string> commands) { foreach (var command in commands) { foreach (var module in Modules) { module.PreWorkspace(workspace, command); } } foreach (var repository in workspace.FindRepositories()) { RunCommands(repository, commands); } foreach (var command in commands) { foreach (var module in Modules) { module.PostWorkspace(workspace, command); } } }