protected override IEnumerable <Task> ExtraJobs(Func <IMutagenReadStream> streamGetter) { foreach (var t in base.ExtraJobs(streamGetter)) { yield return(t); } foreach (var source in EnumExt.GetValues <StringsSource>()) { yield return(TaskExt.Run(DoMultithreading, () => { return ProcessStringsFilesIndices(streamGetter, new DirectoryInfo(Path.GetDirectoryName(this.SourcePath)), Language.English, source, ModKey.FromNameAndExtension(Path.GetFileName(this.SourcePath))); })); } }
protected override IEnumerable <Task> ExtraJobs(Func <IMutagenReadStream> streamGetter) { foreach (var t in base.ExtraJobs(streamGetter)) { yield return(t); } var bsaOrder = Archive.GetTypicalOrder(GameRelease).ToList(); foreach (var source in EnumExt.GetValues <StringsSource>()) { yield return(TaskExt.Run(DoMultithreading, () => { return ProcessStringsFilesIndices( streamGetter, new DirectoryInfo(Path.GetDirectoryName(this.SourcePath)), Language.English, source, ModKey.FromNameAndExtension(Path.GetFileName(this.SourcePath)), knownDeadKeys: null, bsaOrder: bsaOrder); })); } }
protected virtual IEnumerable <Task> ExtraJobs(Func <IMutagenReadStream> streamGetter) { yield return(TaskExt.Run(DoMultithreading, () => RemoveEmptyGroups(streamGetter))); }
public async Task DoWork( NugetVersionPair versions, CancellationToken cancel) { var baseFolder = Path.Combine( _temporaryDirectoryProvider.Path, "SynthesisUnitTests", "Impact"); _fileSystem.Directory.DeleteEntireFolder(baseFolder); using var temp = _tempFolderProvider.Create(baseFolder, deleteAfter: true); var failedDeps = new List <Dependent>(); var projResults = new List <ProjectResult>(); versions = versions with { Mutagen = versions.Mutagen ?? Versions.MutagenVersion, Synthesis = versions.Synthesis ?? Versions.SynthesisVersion, }; System.Console.WriteLine($"Mutagen: {versions.Mutagen}"); System.Console.WriteLine($"Synthesis: {versions.Synthesis}"); var deps = await GitHubDependents.GitHubDependents.GetDependents( user : RegistryConstants.GithubUser, repository : RegistryConstants.GithubRepoName, packageID : RegistryConstants.PackageId, pages : byte.MaxValue) .ToArrayAsync(); bool doThreading = false; await Task.WhenAll(deps.GroupBy(x => x.User).Select(group => TaskExt.Run(doThreading, async() => { cancel.ThrowIfCancellationRequested(); if (group.Key == null) { return; } await Task.WhenAll(group.Select(dependency => TaskExt.Run(doThreading, async() => { cancel.ThrowIfCancellationRequested(); try { if (dependency.User.IsNullOrWhitespace() || dependency.Repository.IsNullOrWhitespace()) { return; } var repoDir = Directory.CreateDirectory(Path.Combine(temp.Dir.Path, group.Key, dependency.Repository)); var clonePath = $"https://github.com/{dependency.User}/{dependency.Repository}"; try { Repository.Clone(clonePath, repoDir.FullName); } catch (Exception ex) { System.Console.Error.WriteLine($"Failed to clone {clonePath}"); System.Console.Error.WriteLine(ex); failedDeps.Add(dependency); return; } cancel.ThrowIfCancellationRequested(); using var repo = new Repository(repoDir.FullName); var slnPath = new SolutionFileLocator( IFileSystemExt.DefaultFilesystem) .GetPath(repo.Info.WorkingDirectory); if (slnPath == null) { System.Console.Error.WriteLine($"Could not get path to solution {clonePath}"); failedDeps.Add(dependency); return; } _modifyRunnerProjects.Modify( solutionPath: slnPath.Value, drivingProjSubPath: string.Empty, versions: versions, out var _); foreach (var proj in _availableProjectsRetriever.Get(slnPath.Value)) { cancel.ThrowIfCancellationRequested(); var path = Path.Combine(repoDir.FullName, proj); if (!ApplicabilityTests.IsMutagenPatcherProject(path)) { System.Console.WriteLine($"Skipping {group.Key}/{dependency.Repository}:{proj}"); continue; } System.Console.WriteLine($"Checking {group.Key}/{dependency.Repository}:{proj}"); var compile = await _build.Compile(path, cancel); if (compile.Failed) { System.Console.WriteLine("Failed compilation"); } projResults.Add(new ProjectResult( dependency, $"{Path.GetDirectoryName(slnPath)}\\{group.Key}\\", proj, compile)); } } catch (Exception ex) { System.Console.Error.WriteLine($"Failed to check {dependency}"); System.Console.Error.WriteLine(ex); return; } })));