Search in sources :

Example 1 with BindingGraphPlugin

use of dagger.spi.model.BindingGraphPlugin in project DaggerCodeParse-2.38.1base by hellogaod.

the class ValidationBindingGraphPlugins method visit.

/**
 * Returns {@code false} if any of the plugins reported an error.
 */
boolean visit(BindingGraph graph) {
    boolean errorsAsWarnings = graph.isFullBindingGraph() && compilerOptions.fullBindingGraphValidationType().equals(ValidationType.WARNING);
    boolean isClean = true;
    for (BindingGraphPlugin plugin : plugins) {
        DiagnosticReporterFactory.DiagnosticReporterImpl reporter = diagnosticReporterFactory.reporter(graph, plugin.pluginName(), errorsAsWarnings);
        plugin.visitGraph(graph, reporter);
        if (reporter.reportedDiagnosticKinds().contains(ERROR)) {
            isClean = false;
        }
    }
    return isClean;
}
Also used : BindingGraphPlugin(dagger.spi.model.BindingGraphPlugin)

Example 2 with BindingGraphPlugin

use of dagger.spi.model.BindingGraphPlugin in project dapper by jbock-java.

the class ValidationBindingGraphPlugins method visit.

/**
 * Returns {@code false} if any of the plugins reported an error.
 */
boolean visit(BindingGraph graph) {
    boolean errorsAsWarnings = graph.isFullBindingGraph() && compilerOptions.fullBindingGraphValidationType().equals(ValidationType.WARNING);
    boolean isClean = true;
    for (BindingGraphPlugin plugin : plugins) {
        DiagnosticReporterImpl reporter = diagnosticReporterFactory.reporter(graph, plugin.pluginName(), errorsAsWarnings);
        plugin.visitGraph(graph, reporter);
        if (reporter.reportedDiagnosticKinds().contains(ERROR)) {
            isClean = false;
        }
    }
    return isClean;
}
Also used : DiagnosticReporterImpl(dagger.internal.codegen.validation.DiagnosticReporterFactory.DiagnosticReporterImpl) BindingGraphPlugin(dagger.spi.model.BindingGraphPlugin)

Example 3 with BindingGraphPlugin

use of dagger.spi.model.BindingGraphPlugin in project DaggerCodeParse-2.38.1base by hellogaod.

the class ExternalBindingGraphPlugins method visit.

/**
 * Returns {@code false} if any of the plugins reported an error.
 */
boolean visit(dagger.spi.model.BindingGraph spiGraph) {
    BindingGraph graph = ExternalBindingGraphConverter.fromSpiModel(spiGraph);
    boolean isClean = true;
    for (BindingGraphPlugin plugin : plugins) {
        DiagnosticReporterFactory.DiagnosticReporterImpl spiReporter = diagnosticReporterFactory.reporter(spiGraph, plugin.pluginName(), /* reportErrorsAsWarnings= */
        false);
        DiagnosticReporter reporter = ExternalBindingGraphConverter.fromSpiModel(spiReporter);
        plugin.visitGraph(graph, reporter);
        if (spiReporter.reportedDiagnosticKinds().contains(ERROR)) {
            isClean = false;
        }
    }
    return isClean;
}
Also used : BindingGraph(dagger.model.BindingGraph) DiagnosticReporter(dagger.spi.DiagnosticReporter) BindingGraphPlugin(dagger.spi.model.BindingGraphPlugin)

Example 4 with BindingGraphPlugin

use of dagger.spi.model.BindingGraphPlugin in project dapper by jbock-java.

the class ExternalBindingGraphPlugins method visit.

/**
 * Returns {@code false} if any of the plugins reported an error.
 */
boolean visit(BindingGraph graph) {
    // Return early to avoid converting the binding graph when there are no externl plugins.
    if (plugins.isEmpty()) {
        return true;
    }
    boolean isClean = true;
    for (BindingGraphPlugin plugin : plugins) {
        DiagnosticReporterImpl reporter = diagnosticReporterFactory.reporter(graph, plugin.pluginName(), /* reportErrorsAsWarnings= */
        false);
        plugin.visitGraph(graph, reporter);
        if (reporter.reportedDiagnosticKinds().contains(ERROR)) {
            isClean = false;
        }
    }
    return isClean;
}
Also used : DiagnosticReporterImpl(dagger.internal.codegen.validation.DiagnosticReporterFactory.DiagnosticReporterImpl) BindingGraphPlugin(dagger.spi.model.BindingGraphPlugin)

Aggregations

BindingGraphPlugin (dagger.spi.model.BindingGraphPlugin)4 DiagnosticReporterImpl (dagger.internal.codegen.validation.DiagnosticReporterFactory.DiagnosticReporterImpl)2 BindingGraph (dagger.model.BindingGraph)1 DiagnosticReporter (dagger.spi.DiagnosticReporter)1