Search in sources :

Example 1 with SelectedFeature

use of io.micronaut.starter.analytics.SelectedFeature in project micronaut-starter by micronaut-projects.

the class GenerationListener method onApplicationGenerated.

@EventListener
void onApplicationGenerated(ApplicationGeneratingEvent event) {
    GeneratorContext context = event.getSource();
    List<SelectedFeature> features = context.getFeatures().stream().map(SelectedFeature::new).collect(Collectors.toList());
    Generated generated = new Generated(context.getApplicationType(), context.getLanguage(), context.getBuildTool(), context.getTestFramework(), context.getJdkVersion());
    generated.setSelectedFeatures(features);
    if (analyticsOperations != null) {
        analyticsOperations.applicationGenerated(generated).whenComplete((httpStatus, throwable) -> {
            if (throwable != null) {
                if (LOG.isErrorEnabled()) {
                    LOG.error("Error occurred reporting analytics: " + throwable.getMessage(), throwable);
                }
            }
        });
    }
}
Also used : SelectedFeature(io.micronaut.starter.analytics.SelectedFeature) Generated(io.micronaut.starter.analytics.Generated) GeneratorContext(io.micronaut.starter.application.generator.GeneratorContext) EventListener(io.micronaut.runtime.event.annotation.EventListener)

Aggregations

EventListener (io.micronaut.runtime.event.annotation.EventListener)1 Generated (io.micronaut.starter.analytics.Generated)1 SelectedFeature (io.micronaut.starter.analytics.SelectedFeature)1 GeneratorContext (io.micronaut.starter.application.generator.GeneratorContext)1