Search in sources :

Example 1 with VersionControlCmdLineInterfaceFactory

use of com.facebook.buck.util.versioncontrol.VersionControlCmdLineInterfaceFactory in project buck by facebook.

the class RageCommand method runWithoutHelp.

@Override
public int runWithoutHelp(CommandRunnerParams params) throws IOException, InterruptedException {
    ProjectFilesystem filesystem = params.getCell().getFilesystem();
    BuckConfig buckConfig = params.getBuckConfig();
    RageConfig rageConfig = RageConfig.of(buckConfig);
    ProcessExecutor processExecutor = new DefaultProcessExecutor(params.getConsole());
    VersionControlCmdLineInterfaceFactory vcsFactory = new DefaultVersionControlCmdLineInterfaceFactory(params.getCell().getFilesystem().getRootPath(), new PrintStreamProcessExecutorFactory(), new VersionControlBuckConfig(buckConfig), buckConfig.getEnvironment());
    Optional<VcsInfoCollector> vcsInfoCollector = VcsInfoCollector.create(vcsFactory.createCmdLineInterface());
    ExtraInfoCollector extraInfoCollector = new DefaultExtraInfoCollector(rageConfig, filesystem, processExecutor);
    Optional<WatchmanDiagReportCollector> watchmanDiagReportCollector = WatchmanDiagReportCollector.newInstanceIfWatchmanUsed(params.getCell(), filesystem, processExecutor, new ExecutableFinder(), params.getEnvironment());
    AbstractReport report;
    DefaultDefectReporter reporter = new DefaultDefectReporter(filesystem, params.getObjectMapper(), rageConfig, params.getBuckEventBus(), params.getClock());
    if (params.getConsole().getAnsi().isAnsiTerminal() && !nonInteractive) {
        report = new InteractiveReport(reporter, filesystem, params.getObjectMapper(), params.getConsole(), params.getStdIn(), params.getBuildEnvironmentDescription(), vcsInfoCollector, rageConfig, extraInfoCollector, watchmanDiagReportCollector);
    } else {
        report = new AutomatedReport(reporter, filesystem, params.getObjectMapper(), params.getConsole(), params.getBuildEnvironmentDescription(), gatherVcsInfo ? vcsInfoCollector : Optional.empty(), rageConfig, extraInfoCollector);
    }
    Optional<DefectSubmitResult> defectSubmitResult = report.collectAndSubmitResult();
    report.presentDefectSubmitResult(defectSubmitResult, showJson);
    return 0;
}
Also used : ExecutableFinder(com.facebook.buck.io.ExecutableFinder) VcsInfoCollector(com.facebook.buck.rage.VcsInfoCollector) AutomatedReport(com.facebook.buck.rage.AutomatedReport) DefaultProcessExecutor(com.facebook.buck.util.DefaultProcessExecutor) DefaultExtraInfoCollector(com.facebook.buck.rage.DefaultExtraInfoCollector) ExtraInfoCollector(com.facebook.buck.rage.ExtraInfoCollector) RageConfig(com.facebook.buck.rage.RageConfig) DefaultVersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.DefaultVersionControlCmdLineInterfaceFactory) VersionControlBuckConfig(com.facebook.buck.util.versioncontrol.VersionControlBuckConfig) ProcessExecutor(com.facebook.buck.util.ProcessExecutor) DefaultProcessExecutor(com.facebook.buck.util.DefaultProcessExecutor) DefaultVersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.DefaultVersionControlCmdLineInterfaceFactory) VersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.VersionControlCmdLineInterfaceFactory) DefectSubmitResult(com.facebook.buck.rage.DefectSubmitResult) VersionControlBuckConfig(com.facebook.buck.util.versioncontrol.VersionControlBuckConfig) WatchmanDiagReportCollector(com.facebook.buck.rage.WatchmanDiagReportCollector) AbstractReport(com.facebook.buck.rage.AbstractReport) InteractiveReport(com.facebook.buck.rage.InteractiveReport) DefaultDefectReporter(com.facebook.buck.rage.DefaultDefectReporter) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) PrintStreamProcessExecutorFactory(com.facebook.buck.util.PrintStreamProcessExecutorFactory) DefaultExtraInfoCollector(com.facebook.buck.rage.DefaultExtraInfoCollector)

Example 2 with VersionControlCmdLineInterfaceFactory

use of com.facebook.buck.util.versioncontrol.VersionControlCmdLineInterfaceFactory in project buck by facebook.

the class DoctorCommand method generateRageReport.

private Optional<DefectSubmitResult> generateRageReport(CommandRunnerParams params, UserInput userInput, BuildLogEntry entry) throws IOException, InterruptedException {
    RageConfig rageConfig = RageConfig.of(params.getBuckConfig());
    VersionControlCmdLineInterfaceFactory vcsFactory = new DefaultVersionControlCmdLineInterfaceFactory(params.getCell().getFilesystem().getRootPath(), new PrintStreamProcessExecutorFactory(), new VersionControlBuckConfig(params.getBuckConfig()), params.getBuckConfig().getEnvironment());
    Optional<WatchmanDiagReportCollector> watchmanDiagReportCollector = WatchmanDiagReportCollector.newInstanceIfWatchmanUsed(params.getCell(), params.getCell().getFilesystem(), new DefaultProcessExecutor(params.getConsole()), new ExecutableFinder(), params.getEnvironment());
    DoctorInteractiveReport report = new DoctorInteractiveReport(new DefaultDefectReporter(params.getCell().getFilesystem(), params.getObjectMapper(), rageConfig, params.getBuckEventBus(), params.getClock()), params.getCell().getFilesystem(), params.getConsole(), userInput, params.getBuildEnvironmentDescription(), VcsInfoCollector.create(vcsFactory.createCmdLineInterface()), rageConfig, new DefaultExtraInfoCollector(rageConfig, params.getCell().getFilesystem(), new DefaultProcessExecutor(params.getConsole())), ImmutableSet.of(entry), watchmanDiagReportCollector);
    return report.collectAndSubmitResult();
}
Also used : VersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.VersionControlCmdLineInterfaceFactory) DefaultVersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.DefaultVersionControlCmdLineInterfaceFactory) ExecutableFinder(com.facebook.buck.io.ExecutableFinder) DefaultProcessExecutor(com.facebook.buck.util.DefaultProcessExecutor) WatchmanDiagReportCollector(com.facebook.buck.rage.WatchmanDiagReportCollector) RageConfig(com.facebook.buck.rage.RageConfig) DefaultVersionControlCmdLineInterfaceFactory(com.facebook.buck.util.versioncontrol.DefaultVersionControlCmdLineInterfaceFactory) VersionControlBuckConfig(com.facebook.buck.util.versioncontrol.VersionControlBuckConfig) DefaultDefectReporter(com.facebook.buck.rage.DefaultDefectReporter) PrintStreamProcessExecutorFactory(com.facebook.buck.util.PrintStreamProcessExecutorFactory) DefaultExtraInfoCollector(com.facebook.buck.rage.DefaultExtraInfoCollector) DoctorInteractiveReport(com.facebook.buck.rage.DoctorInteractiveReport)

Aggregations

ExecutableFinder (com.facebook.buck.io.ExecutableFinder)2 DefaultDefectReporter (com.facebook.buck.rage.DefaultDefectReporter)2 DefaultExtraInfoCollector (com.facebook.buck.rage.DefaultExtraInfoCollector)2 RageConfig (com.facebook.buck.rage.RageConfig)2 WatchmanDiagReportCollector (com.facebook.buck.rage.WatchmanDiagReportCollector)2 DefaultProcessExecutor (com.facebook.buck.util.DefaultProcessExecutor)2 PrintStreamProcessExecutorFactory (com.facebook.buck.util.PrintStreamProcessExecutorFactory)2 DefaultVersionControlCmdLineInterfaceFactory (com.facebook.buck.util.versioncontrol.DefaultVersionControlCmdLineInterfaceFactory)2 VersionControlBuckConfig (com.facebook.buck.util.versioncontrol.VersionControlBuckConfig)2 VersionControlCmdLineInterfaceFactory (com.facebook.buck.util.versioncontrol.VersionControlCmdLineInterfaceFactory)2 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 AbstractReport (com.facebook.buck.rage.AbstractReport)1 AutomatedReport (com.facebook.buck.rage.AutomatedReport)1 DefectSubmitResult (com.facebook.buck.rage.DefectSubmitResult)1 DoctorInteractiveReport (com.facebook.buck.rage.DoctorInteractiveReport)1 ExtraInfoCollector (com.facebook.buck.rage.ExtraInfoCollector)1 InteractiveReport (com.facebook.buck.rage.InteractiveReport)1 VcsInfoCollector (com.facebook.buck.rage.VcsInfoCollector)1 ProcessExecutor (com.facebook.buck.util.ProcessExecutor)1