Search in sources :

Example 1 with ValidateSchemaAnnotationTask

use of com.linkedin.pegasus.gradle.tasks.ValidateSchemaAnnotationTask in project rest.li by linkedin.

the class PegasusPlugin method configureSchemaAnnotationValidation.

protected void configureSchemaAnnotationValidation(Project project, SourceSet sourceSet, GenerateDataTemplateTask generateDataTemplatesTask) {
    // Task would execute based on the following order.
    // generateDataTemplatesTask -> validateSchemaAnnotationTask
    // Create ValidateSchemaAnnotation task
    ValidateSchemaAnnotationTask validateSchemaAnnotationTask = project.getTasks().create(sourceSet.getTaskName("validate", "schemaAnnotation"), ValidateSchemaAnnotationTask.class, task -> {
        task.setInputDir(generateDataTemplatesTask.getInputDir());
        // same resolver path as generateDataTemplatesTask
        task.setResolverPath(getDataModelConfig(project, sourceSet));
        task.setClassPath(project.getConfigurations().getByName(SCHEMA_ANNOTATION_HANDLER_CONFIGURATION).plus(project.getConfigurations().getByName(PEGASUS_PLUGIN_CONFIGURATION)).plus(project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
        task.setHandlerJarPath(project.getConfigurations().getByName(SCHEMA_ANNOTATION_HANDLER_CONFIGURATION));
        if (isPropertyTrue(project, ENABLE_ARG_FILE)) {
            task.setEnableArgFile(true);
        }
    });
    // validateSchemaAnnotationTask depend on generateDataTemplatesTask
    validateSchemaAnnotationTask.dependsOn(generateDataTemplatesTask);
    // Check depends on validateSchemaAnnotationTask.
    project.getTasks().getByName("check").dependsOn(validateSchemaAnnotationTask);
}
Also used : ValidateSchemaAnnotationTask(com.linkedin.pegasus.gradle.tasks.ValidateSchemaAnnotationTask)

Aggregations

ValidateSchemaAnnotationTask (com.linkedin.pegasus.gradle.tasks.ValidateSchemaAnnotationTask)1