
org.gradle.api.plugins.HelpTasksPlugin Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.plugins;
import org.gradle.api.Action;
import org.gradle.api.Incubating;
import org.gradle.api.Plugin;
import org.gradle.api.internal.component.BuildableJavaComponent;
import org.gradle.api.internal.component.ComponentRegistry;
import org.gradle.api.internal.plugins.DslObject;
import org.gradle.api.internal.project.ProjectInternal;
import org.gradle.api.internal.tasks.TaskContainerInternal;
import org.gradle.api.reporting.components.ComponentReport;
import org.gradle.api.reporting.model.ModelReport;
import org.gradle.api.tasks.diagnostics.*;
import org.gradle.configuration.Help;
import org.gradle.internal.service.ServiceRegistry;
import org.gradle.model.Defaults;
import org.gradle.model.Path;
import org.gradle.model.RuleSource;
import java.util.concurrent.Callable;
/**
* Adds various reporting tasks that provide information about the project.
*/
@Incubating
public class HelpTasksPlugin implements Plugin {
public static final String HELP_GROUP = "help";
public static final String PROPERTIES_TASK = "properties";
public static final String DEPENDENCIES_TASK = "dependencies";
public static final String DEPENDENCY_INSIGHT_TASK = "dependencyInsight";
public static final String COMPONENTS_TASK = "components";
public static final String MODEL_TASK = "model";
@Override
public void apply(final ProjectInternal project) {
final TaskContainerInternal tasks = project.getTasks();
// static classes are used for the actions to avoid implicitly dragging project/tasks into the model registry
String projectName = project.toString();
tasks.addPlaceholderAction(ProjectInternal.HELP_TASK, Help.class, new HelpAction());
tasks.addPlaceholderAction(ProjectInternal.PROJECTS_TASK, ProjectReportTask.class, new ProjectReportTaskAction(projectName));
tasks.addPlaceholderAction(ProjectInternal.TASKS_TASK, TaskReportTask.class, new TaskReportTaskAction(projectName, project.getChildProjects().isEmpty()));
tasks.addPlaceholderAction(PROPERTIES_TASK, PropertyReportTask.class, new PropertyReportTaskAction(projectName));
tasks.addPlaceholderAction(DEPENDENCY_INSIGHT_TASK, DependencyInsightReportTask.class, new DependencyInsightReportTaskAction(projectName));
tasks.addPlaceholderAction(DEPENDENCIES_TASK, DependencyReportTask.class, new DependencyReportTaskAction(projectName));
tasks.addPlaceholderAction(BuildEnvironmentReportTask.TASK_NAME, BuildEnvironmentReportTask.class, new BuildEnvironmentReportTaskAction(projectName));
tasks.addPlaceholderAction(COMPONENTS_TASK, ComponentReport.class, new ComponentReportAction(projectName));
tasks.addPlaceholderAction(MODEL_TASK, ModelReport.class, new ModelReportAction(projectName));
}
static class Rules extends RuleSource {
@Defaults
void addDefaultDependenciesReportConfiguration(@Path("tasks.dependencyInsight") DependencyInsightReportTask task, final ServiceRegistry services) {
new DslObject(task).getConventionMapping().map("configuration", new Callable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy