use of gradlebuild.docs.dsl.source.GenerateDefaultImports in project gradle by gradle.
the class GradleUserManualPlugin method generateDefaultImports.
// TODO: This doesn't really make sense to be part of the user manual generation, but it's so tied up into it
// it's left here for a future project.
private void generateDefaultImports(Project project, TaskContainer tasks, GradleDocumentationExtension extension) {
List<String> excludedPackages = getDefaultExcludedPackages();
Provider<Directory> generatedDirectory = extension.getUserManual().getStagingRoot().dir("generated");
TaskProvider<GenerateApiMapping> apiMapping = tasks.register("apiMapping", GenerateApiMapping.class, task -> {
task.getMetaDataFile().convention(extension.getDslReference().getGeneratedMetaDataFile());
task.getMappingDestFile().convention(generatedDirectory.map(dir -> dir.file("api-mapping.txt")));
task.getExcludedPackages().convention(excludedPackages);
});
TaskProvider<GenerateDefaultImports> defaultImports = tasks.register("defaultImports", GenerateDefaultImports.class, task -> {
task.getMetaDataFile().convention(extension.getDslReference().getGeneratedMetaDataFile());
task.getImportsDestFile().convention(generatedDirectory.map(dir -> dir.file("default-imports.txt")));
task.getExcludedPackages().convention(excludedPackages);
});
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
sourceSets.getByName("main", main -> main.getOutput().dir(singletonMap("builtBy", asList(apiMapping, defaultImports)), generatedDirectory));
extension.getUserManual().getResources().from(apiMapping);
extension.getUserManual().getResources().from(defaultImports);
}
Aggregations