All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gradle.internal.buildtree.BuildTreeWorkGraph Maven / Gradle / Ivy

There is a newer version: 8.11.1
Show newest version
/*
 * Copyright 2021 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.internal.buildtree;

import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
import org.gradle.composite.internal.TaskIdentifier;
import org.gradle.execution.EntryTaskSelector;
import org.gradle.execution.plan.ExecutionPlan;
import org.gradle.execution.plan.QueryableExecutionPlan;
import org.gradle.internal.build.BuildLifecycleController;
import org.gradle.internal.build.BuildState;
import org.gradle.internal.build.ExecutionResult;

import java.util.Collection;
import java.util.function.BiConsumer;
import java.util.function.Consumer;

/**
 * Represents a set of work to be executed across a build tree.
 */
public interface BuildTreeWorkGraph {
    /**
     * Schedules work using the given action and then prepares this work graphs for execution. Does not run any work until {@link FinalizedGraph#runWork()} is called.
     *
     * 

This can be called only once for a given graph.

*/ FinalizedGraph scheduleWork(Consumer action); interface FinalizedGraph { /** * Runs any scheduled work, blocking until complete. Does nothing when {@link #scheduleWork(Consumer)} has not been called to schedule the work. * *

This can be called only once for a given graph.

*/ ExecutionResult runWork(); } interface Builder { /** * Adds nodes to the work graph for the given build. */ void withWorkGraph(BuildState target, Consumer action); /** * Adds the given tasks and their dependencies to the work graph. */ void scheduleTasks(Collection tasksToBuild); /** * Adds add task filter to the given build. */ void addFilter(BuildState target, Spec filter); /** * Adds a {@link ExecutionPlan} finalization step to the given build. */ void addFinalization(BuildState target, BiConsumer finalization); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy