internal static SourceUnit FromProject(Project project, string root) { var su = new SourceUnit { Name = project.Name, Dir = Utils.GetRelativePath(project.ProjectDirectory, root), Files = project.Files.SourceFiles.Select(p => Utils.GetRelativePath(p, root)).OrderByDescending(p => p).ToArray(), Dependencies = project.Dependencies.Select(DependencyInfo.FromLibraryDependency).ToArray(), Ops = new Dictionary<string, string> { { "depresolve", null } } }; return su; }
internal static SourceUnit FromDirectory(string name, string root) { DirectoryInfo di = new DirectoryInfo(root); FileInfo[] sources = DepresolveConsoleCommand.FindSources(di); string[] files = new string[sources.Length]; for (int i = 0; i < sources.Length; i++) { files[i] = Utils.GetRelativePath(sources[i].FullName, root); } files.OrderByDescending(p => p); var su = new SourceUnit { Name = name, Dir = root, Files = files, Dependencies = new DependencyInfo[0], Ops = new Dictionary<string, string> { { "depresolve", null } } }; return su; }