public static IEnumerable <MBEV.ResolvedImport> Children(this MBEV.ResolvedImport import, MBEV.Project project) { return(project.Imports.Where( i => string.Equals(i.ImportingElement.ContainingProject.FullPath, project.ResolveAllProperties(import.ImportedProject.Location.File), StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets a collection of ProjectTargetInstances that this target is dependent on in a given project. /// </summary> /// <param name="target"></param> /// <param name="project">The project to look in</param> /// <returns></returns> public static IEnumerable <MBEX.ProjectTargetInstance> Dependencies( this MBEX.ProjectTargetInstance target, MBEV.Project project) { var dependencies = new List <MBEX.ProjectTargetInstance>(); var dependencyTargetNames = project.ResolveAllProperties(target.DependsOnTargets) .Replace(Environment.NewLine, "") .Split(';'); foreach (var name in dependencyTargetNames) { if (!string.IsNullOrWhiteSpace(name)) { dependencies.Add(project.Targets[name.Trim()]); } } return(dependencies); }
private void PrintImportInfo(MBEV.ResolvedImport import, int indentLength) { var indent = indentLength > 0 ? new StringBuilder().Insert(0, " ", indentLength).ToString() : ""; Utils.WriteColor(indent, ConsoleColor.White); Utils.WriteColor($"{import.ImportingElement.Location.Line}: ", ConsoleColor.Cyan); var importedProjectFile = project.ResolveAllProperties(import.ImportedProject.Location.File); Utils.WriteColor(Path.GetDirectoryName(importedProjectFile) + Path.DirectorySeparatorChar, ConsoleColor.DarkGreen); Utils.WriteLineColor(Path.GetFileName(importedProjectFile), ConsoleColor.Green); if (!string.IsNullOrWhiteSpace(import.ImportingElement.Condition)) { Utils.WriteColor($"{indent}because ", ConsoleColor.DarkGray); Utils.WriteLineColor($"{import.ReducedCondition()}", ConsoleColor.DarkCyan); } Console.WriteLine(); }