Search in sources :

Example 1 with BuildOutputCleanupRegistry

use of org.gradle.internal.execution.BuildOutputCleanupRegistry in project gradle by gradle.

the class DefaultBuildWorkPreparer method finalizeWorkGraph.

@Override
public void finalizeWorkGraph(GradleInternal gradle, ExecutionPlan plan) {
    TaskExecutionGraphInternal taskGraph = gradle.getTaskGraph();
    taskGraph.populate(plan);
    BuildOutputCleanupRegistry buildOutputCleanupRegistry = gradle.getServices().get(BuildOutputCleanupRegistry.class);
    buildOutputCleanupRegistry.resolveOutputs();
}
Also used : BuildOutputCleanupRegistry(org.gradle.internal.execution.BuildOutputCleanupRegistry) TaskExecutionGraphInternal(org.gradle.execution.taskgraph.TaskExecutionGraphInternal)

Example 2 with BuildOutputCleanupRegistry

use of org.gradle.internal.execution.BuildOutputCleanupRegistry in project gradle by gradle.

the class LifecycleBasePlugin method addClean.

private void addClean(final ProjectInternal project) {
    Provider<Directory> buildDir = project.getLayout().getBuildDirectory();
    // Register at least the project buildDir as a directory to be deleted.
    final BuildOutputCleanupRegistry buildOutputCleanupRegistry = project.getServices().get(BuildOutputCleanupRegistry.class);
    buildOutputCleanupRegistry.registerOutputs(buildDir);
    final Provider<Delete> clean = project.getTasks().register(CLEAN_TASK_NAME, Delete.class, cleanTask -> {
        cleanTask.setDescription("Deletes the build directory.");
        cleanTask.setGroup(BUILD_GROUP);
        cleanTask.delete(buildDir);
    });
    buildOutputCleanupRegistry.registerOutputs(clean.map(cl -> cl.getTargetFiles()));
}
Also used : Delete(org.gradle.api.tasks.Delete) BuildOutputCleanupRegistry(org.gradle.internal.execution.BuildOutputCleanupRegistry) Provider(org.gradle.api.provider.Provider) Delete(org.gradle.api.tasks.Delete) CleanRule(org.gradle.language.base.internal.plugins.CleanRule) Project(org.gradle.api.Project) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) Directory(org.gradle.api.file.Directory) Plugin(org.gradle.api.Plugin) BuildOutputCleanupRegistry(org.gradle.internal.execution.BuildOutputCleanupRegistry) Directory(org.gradle.api.file.Directory)

Example 3 with BuildOutputCleanupRegistry

use of org.gradle.internal.execution.BuildOutputCleanupRegistry in project gradle by gradle.

the class JavaPlugin method apply.

@Override
public void apply(final Project project) {
    if (project.getPluginManager().hasPlugin("java-platform")) {
        throw new IllegalStateException("The \"java\" or \"java-library\" plugin cannot be applied together with the \"java-platform\" plugin. " + "A project is either a platform or a library but cannot be both at the same time.");
    }
    final ProjectInternal projectInternal = (ProjectInternal) project;
    project.getPluginManager().apply(JavaBasePlugin.class);
    project.getPluginManager().apply("org.gradle.jvm-test-suite");
    JavaPluginExtension javaExtension = project.getExtensions().getByType(JavaPluginExtension.class);
    projectInternal.getServices().get(ComponentRegistry.class).setMainComponent(new BuildableJavaComponentImpl(project, javaExtension));
    BuildOutputCleanupRegistry buildOutputCleanupRegistry = projectInternal.getServices().get(BuildOutputCleanupRegistry.class);
    SourceSet mainSourceSet = javaExtension.getSourceSets().create(SourceSet.MAIN_SOURCE_SET_NAME);
    configureSourceSets(project, javaExtension, buildOutputCleanupRegistry, mainSourceSet);
    configureConfigurations(project, javaExtension, mainSourceSet);
    configureJavadocTask(project, javaExtension);
    configureArchivesAndComponent(project, javaExtension);
    configureBuild(project);
}
Also used : SourceSet(org.gradle.api.tasks.SourceSet) BuildOutputCleanupRegistry(org.gradle.internal.execution.BuildOutputCleanupRegistry) ComponentRegistry(org.gradle.api.internal.component.ComponentRegistry) ProjectInternal(org.gradle.api.internal.project.ProjectInternal)

Aggregations

BuildOutputCleanupRegistry (org.gradle.internal.execution.BuildOutputCleanupRegistry)3 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)2 Plugin (org.gradle.api.Plugin)1 Project (org.gradle.api.Project)1 Directory (org.gradle.api.file.Directory)1 ComponentRegistry (org.gradle.api.internal.component.ComponentRegistry)1 Provider (org.gradle.api.provider.Provider)1 Delete (org.gradle.api.tasks.Delete)1 SourceSet (org.gradle.api.tasks.SourceSet)1 TaskExecutionGraphInternal (org.gradle.execution.taskgraph.TaskExecutionGraphInternal)1 CleanRule (org.gradle.language.base.internal.plugins.CleanRule)1