public GitRunSolutionPathProvider(
     ISolutionFileLocator solutionFileLocator,
     IRunnerRepoDirectoryProvider runnerRepoDirectoryProvider)
 {
     SolutionFileLocator         = solutionFileLocator;
     RunnerRepoDirectoryProvider = runnerRepoDirectoryProvider;
 }
Exemple #2
0
 public RunnerRepositoryPreparation(
     ILogger logger,
     ICheckOrCloneRepo checkOrClone,
     IRunnerRepoDirectoryProvider runnerRepoDirectoryProvider,
     IGetRepoPathValidity getRepoPathValidity,
     ISchedulerProvider schedulerProvider)
 {
     State = getRepoPathValidity.RepoPath
             .Throttle(TimeSpan.FromMilliseconds(100), schedulerProvider.MainThread)
             .ObserveOn(schedulerProvider.TaskPool)
             .SelectReplaceWithIntermediate(
         new ConfigurationState(ErrorResponse.Fail("Cloning runner repository"))
     {
         IsHaltingError = false
     },
         async(path, cancel) =>
     {
         if (path.RunnableState.Failed)
         {
             return(path.ToUnit());
         }
         using var timing = logger.Time($"runner repo: {path.Item}");
         return((ErrorResponse)checkOrClone.Check(
                    path.ToGetResponse(),
                    runnerRepoDirectoryProvider.Path,
                    cancel));
     })
             .Replay(1)
             .RefCount();
 }
Exemple #3
0
 public RunnerRepoProjectPathRetriever(
     IFileSystem fileSystem,
     IRunnerRepoDirectoryProvider runnerRepoDirectoryProvider,
     IAvailableProjectsRetriever availableProjectsRetriever)
 {
     _fileSystem = fileSystem;
     RunnerRepoDirectoryProvider = runnerRepoDirectoryProvider;
     AvailableProjectsRetriever  = availableProjectsRetriever;
 }
Exemple #4
0
 public PrepareRunnerRepository(
     ILogger logger,
     ISolutionFileLocator solutionFileLocator,
     IRunnerRepoProjectPathRetriever runnerRepoProjectPathRetriever,
     IModifyRunnerProjects modifyRunnerProjects,
     IResetToTarget resetToTarget,
     IBuildMetaFilePathProvider metaFilePathProvider,
     IRunnerRepoDirectoryProvider runnerRepoDirectoryProvider,
     IProvideRepositoryCheckouts repoCheckouts)
 {
     _logger = logger;
     _metaFilePathProvider          = metaFilePathProvider;
     ResetToTarget                  = resetToTarget;
     SolutionFileLocator            = solutionFileLocator;
     RunnerRepoProjectPathRetriever = runnerRepoProjectPathRetriever;
     ModifyRunnerProjects           = modifyRunnerProjects;
     RunnerRepoDirectoryProvider    = runnerRepoDirectoryProvider;
     RepoCheckouts                  = repoCheckouts;
 }
Exemple #5
0
        public GitPatcherVm(
            IGithubPatcherIdentifier ident,
            IPatcherNameVm nameVm,
            IProfileDisplayControllerVm selPatcher,
            IConfirmationPanelControllerVm confirmation,
            ISelectedProjectInputVm selectedProjectInput,
            IGitRemoteRepoPathInputVm remoteRepoPathInputVm,
            INavigateTo navigate,
            IAvailableTags availableTags,
            ILockToCurrentVersioning lockToCurrentVersioning,
            IAvailableProjects availableProjects,
            ICompilationProvider compilationProvider,
            IBaseRepoDirectoryProvider baseRepoDir,
            IGitStatusDisplay gitStatusDisplay,
            IDriverRepoDirectoryProvider driverRepoDirectoryProvider,
            IRunnerRepoDirectoryProvider runnerRepoDirectoryProvider,
            IGetRepoPathValidity getRepoPathValidity,
            IRepoClonesValidStateVm repoClonesValid,
            INugetDiffProviderVm nugetDiff,
            IGitPatcherState state,
            ILogger logger,
            IRunnableStateProvider runnableStateProvider,
            ILifetimeScope scope,
            IGitPatcherTargetingVm patcherTargeting,
            ICheckoutInputProvider checkoutInputProvider,
            IGitNugetTargetingVm nugetTargetingVm,
            IUpdateAllCommand updateAllCommand,
            IAttemptedCheckout attemptedCheckout,
            IPatcherIdProvider idProvider,
            ICopyOverExtraData copyOverExtraData,
            PatcherRenameActionVm.Factory renameFactory,
            DeleteUserData deleteUserData,
            PatcherUserSettingsVm.Factory settingsVmFactory,
            GithubPatcherSettings?settings = null)
            : base(
                scope, nameVm, selPatcher,
                confirmation, idProvider, renameFactory, settings)
        {
            _logger              = logger;
            _copyOverExtraData   = copyOverExtraData;
            SelectedProjectInput = selectedProjectInput;
            RemoteRepoPathInput  = remoteRepoPathInputVm;
            Locking              = lockToCurrentVersioning;
            RepoClonesValid      = repoClonesValid;
            NugetDiff            = nugetDiff;
            PatcherTargeting     = patcherTargeting;
            NugetTargeting       = nugetTargetingVm;
            UpdateAllCommand     = updateAllCommand;

            DeleteUserDataCommand = ReactiveCommand.Create(deleteUserData.Delete);

            ID = ident.Id;

            CopyInSettings(settings);

            LocalDriverRepoDirectory = driverRepoDirectoryProvider.Path.Path;
            LocalRunnerRepoDirectory = runnerRepoDirectoryProvider.Path.Path;

            _repoValidity = getRepoPathValidity.RepoPath
                            .Select(r => r.RunnableState)
                            .ToGuiProperty(this, nameof(RepoValidity), deferSubscription: true);

            AvailableProjects = availableProjects.Projects;

            AvailableTags = availableTags.Tags;

            _attemptedCheckout = checkoutInputProvider.Input
                                 .Select(attemptedCheckout.Attempted)
                                 .ToGuiProperty(this, nameof(AttemptedCheckout), deferSubscription: true);

            _runnableData = runnableStateProvider.WhenAnyValue(x => x.State.Item)
                            .ToGuiProperty(this, nameof(RunnableData), default(RunnerRepoInfo?), deferSubscription: true);

            _state = state.State
                     .ToGuiProperty(this, nameof(State), new ConfigurationState(ErrorResponse.Fail("Evaluating"))
            {
                IsHaltingError = false
            }, deferSubscription: true);

            OpenGitPageCommand = ReactiveCommand.Create(
                canExecute: this.WhenAnyValue(x => x.RepoValidity)
                .Select(x => x.Succeeded),
                execute: () => navigate.Navigate(RemoteRepoPathInput.RemoteRepoPath));

            OpenGitPageToVersionCommand = ReactiveCommand.Create(
                canExecute: this.WhenAnyFallback(x => x.RunnableData)
                .Select(x => x != null),
                execute: () =>
            {
                try
                {
                    if (RunnableData is not {
                    } runnable)
                    {
                        return;
                    }
                    navigate.Navigate(Path.Combine(RemoteRepoPathInput.RemoteRepoPath, "tree", runnable.Target.Target));
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, "Error opening Git webpage");
                }
            });

            NavigateToInternalFilesCommand = ReactiveCommand.Create(() => navigate.Navigate(baseRepoDir.Path));

            PatcherSettings = settingsVmFactory(
                false,
                compilationProvider.State.Select(c =>
            {
                if (c.RunnableState.Failed)
                {
                    return(new PatcherUserSettingsVm.Inputs(c.RunnableState.BubbleFailure <FilePath>(), null, default));
                }
                return(new PatcherUserSettingsVm.Inputs(GetResponse <FilePath> .Succeed(c.Item.ProjPath), c.Item.TargetVersions.Synthesis, c.Item.MetaPath));
            })
                .DistinctUntilChanged())
                              .DisposeWith(this);

            _statusDisplay = gitStatusDisplay.StatusDisplay
                             .ToGuiProperty(this, nameof(StatusDisplay),
                                            new StatusRecord(
                                                Text: "Initializing",
                                                Processing: false,
                                                Blocking: false,
                                                Command: null), deferSubscription: true);

            SetToLastSuccessfulRunCommand = ReactiveCommand.Create(
                canExecute: this.WhenAnyValue(x => x.LastSuccessfulRun)
                .Select(x =>
            {
                return(x != null &&
                       !x.TargetRepo.IsNullOrWhitespace() &&
                       !x.ProjectSubpath.IsNullOrWhitespace() &&
                       !x.Commit.IsNullOrWhitespace() &&
                       !x.MutagenVersion.IsNullOrWhitespace() &&
                       !x.SynthesisVersion.IsNullOrWhitespace());
            }),
                execute: () =>
            {
                if (LastSuccessfulRun == null)
                {
                    return;
                }
                RemoteRepoPathInput.RemoteRepoPath         = LastSuccessfulRun.TargetRepo;
                this.SelectedProjectInput.ProjectSubpath   = LastSuccessfulRun.ProjectSubpath;
                this.PatcherTargeting.TargetCommit         = LastSuccessfulRun.Commit;
                this.NugetTargeting.ManualMutagenVersion   = LastSuccessfulRun.MutagenVersion;
                this.NugetTargeting.ManualSynthesisVersion = LastSuccessfulRun.SynthesisVersion;
                this.PatcherTargeting.PatcherVersioning    = PatcherVersioningEnum.Commit;
                this.NugetTargeting.SynthesisVersioning    = PatcherNugetVersioningEnum.Manual;
                this.NugetTargeting.MutagenVersioning      = PatcherNugetVersioningEnum.Manual;
            });
        }