diff --git a/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectCollection.java b/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectCollection.java index be02c330dc48..ebf4c290ff24 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectCollection.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectCollection.java @@ -168,7 +168,6 @@ public interface DomainObjectCollection extends Collection { * @param action A {@link Action} that can configure the element when required. * @since 4.9 */ - @Incubating void configureEach(Action action); // note: this is here to override the default Groovy Collection.findAll { } method. diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectCollection.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectCollection.java index d995011fcce5..370cb1b4761d 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectCollection.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectCollection.java @@ -226,7 +226,6 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection named(String name) throws UnknownDomainObjectException; /** @@ -238,7 +237,6 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection named(String name, Action configurationAction) throws UnknownDomainObjectException; /** @@ -250,7 +248,6 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection NamedDomainObjectProvider named(String name, Class type) throws UnknownDomainObjectException; /** @@ -264,7 +261,6 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection NamedDomainObjectProvider named(String name, Class type, Action configurationAction) throws UnknownDomainObjectException; /** @@ -273,6 +269,5 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection extends NamedDomainObjectSet, * @throws InvalidUserDataException If a object with the given name already exists in this project. * @since 4.10 */ - @Incubating NamedDomainObjectProvider register(String name, Action configurationAction) throws InvalidUserDataException; /** @@ -106,6 +105,5 @@ public interface NamedDomainObjectContainer extends NamedDomainObjectSet, * @throws InvalidUserDataException If a object with the given name already exists in this project. * @since 4.10 */ - @Incubating NamedDomainObjectProvider register(String name) throws InvalidUserDataException; } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectProvider.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectProvider.java index 9ea17bd03114..3d4d69c78dae 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectProvider.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectProvider.java @@ -24,7 +24,6 @@ * @param type of domain object * @since 4.10 */ -@Incubating public interface NamedDomainObjectProvider extends Provider { /** * Configures the domain object with the given action. Actions are run in the order added. diff --git a/subprojects/core-api/src/main/java/org/gradle/api/PolymorphicDomainObjectContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/PolymorphicDomainObjectContainer.java index f1ab834cfb23..fa827877974a 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/PolymorphicDomainObjectContainer.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/PolymorphicDomainObjectContainer.java @@ -96,7 +96,6 @@ public interface PolymorphicDomainObjectContainer extends NamedDomainObjectCo * @throws InvalidUserDataException If a object with the given name already exists in this project. * @since 4.10 */ - @Incubating NamedDomainObjectProvider register(String name, Class type, Action configurationAction) throws InvalidUserDataException; /** @@ -111,6 +110,5 @@ public interface PolymorphicDomainObjectContainer extends NamedDomainObjectCo * @throws InvalidUserDataException If a object with the given name already exists in this project. * @since 4.10 */ - @Incubating NamedDomainObjectProvider register(String name, Class type) throws InvalidUserDataException; } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/provider/Provider.java b/subprojects/core-api/src/main/java/org/gradle/api/provider/Provider.java index 56423ed71155..0a4b14dd4ee4 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/provider/Provider.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/provider/Provider.java @@ -65,7 +65,6 @@ * @param Type of value represented by provider * @since 4.0 */ -@Incubating @HasInternalProtocol @NonExtensible public interface Provider { @@ -120,6 +119,7 @@ public interface Provider { * @param transformer The transformer to apply to values. Should not return {@code null}. * @since 5.0 */ + @Incubating Provider flatMap(Transformer, ? super T> transformer); /** diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskCollection.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskCollection.java index 7ad05416d4ad..0dc3b9ae8eee 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskCollection.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskCollection.java @@ -17,7 +17,6 @@ import groovy.lang.Closure; import org.gradle.api.Action; -import org.gradle.api.Incubating; import org.gradle.api.NamedDomainObjectSet; import org.gradle.api.Task; import org.gradle.api.UnknownTaskException; @@ -92,7 +91,6 @@ public interface TaskCollection extends NamedDomainObjectSet * @throws UnknownTaskException If a task with the given name is not defined. * @since 4.9 */ - @Incubating TaskProvider named(String name) throws UnknownTaskException; /** @@ -100,7 +98,6 @@ public interface TaskCollection extends NamedDomainObjectSet * * @since 5.0 */ - @Incubating TaskProvider named(String name, Action configurationAction) throws UnknownTaskException; @@ -109,7 +106,6 @@ public interface TaskCollection extends NamedDomainObjectSet * * @since 5.0 */ - @Incubating TaskProvider named(String name, Class type) throws UnknownTaskException; /** @@ -117,6 +113,5 @@ public interface TaskCollection extends NamedDomainObjectSet * * @since 5.0 */ - @Incubating TaskProvider named(String name, Class type, Action configurationAction) throws UnknownTaskException; } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskContainer.java index 0aeda74ba0a6..f6afb5b1f990 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskContainer.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskContainer.java @@ -204,7 +204,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb * @throws InvalidUserDataException If a task with the given name already exists in this project. * @since 4.9 */ - @Incubating TaskProvider register(String name, Action configurationAction) throws InvalidUserDataException; /** @@ -220,7 +219,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb * @throws InvalidUserDataException If a task with the given name already exists in this project. * @since 4.9 */ - @Incubating TaskProvider register(String name, Class type, Action configurationAction) throws InvalidUserDataException; /** @@ -235,7 +233,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb * @throws InvalidUserDataException If a task with the given name already exists in this project. * @since 4.9 */ - @Incubating TaskProvider register(String name, Class type) throws InvalidUserDataException; /** @@ -251,7 +248,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb * @throws NullPointerException If any of the values in {@code constructorArgs} is null. * @since 4.9 */ - @Incubating TaskProvider register(String name, Class type, Object... constructorArgs) throws InvalidUserDataException; /** @@ -264,7 +260,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb * @throws InvalidUserDataException If a task with the given name already exists in this project. * @since 4.9 */ - @Incubating TaskProvider register(String name) throws InvalidUserDataException; /** diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskProvider.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskProvider.java index d1857188629a..25f241a32031 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskProvider.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskProvider.java @@ -18,7 +18,6 @@ import org.gradle.api.Action; import org.gradle.api.NamedDomainObjectProvider; -import org.gradle.api.Incubating; import org.gradle.api.Task; /** @@ -27,7 +26,6 @@ * @param Task type * @since 4.8 */ -@Incubating public interface TaskProvider extends NamedDomainObjectProvider { /** * Configures the task with the given action. Actions are run in the order added. diff --git a/subprojects/docs/src/docs/release/notes.md b/subprojects/docs/src/docs/release/notes.md index a5d1f14360ae..3001d99f44ae 100644 --- a/subprojects/docs/src/docs/release/notes.md +++ b/subprojects/docs/src/docs/release/notes.md @@ -46,6 +46,31 @@ The following are the features that have been promoted in this Gradle release. ### Example promoted --> +### Configuration avoidance for Tasks + +[In a recent blog post](https://blog.gradle.org/preview-avoiding-task-configuration-time), we described a new API for creating and configuration `Task` instances that allow Gradle to avoid creating and configuring tasks that do not need to be executed. + +In this release, we now [recommend that you use this new API when working with tasks](userguide/task_configuration_avoidance.html). + +By default, the Kotlin DSL [uses the new APIs](current/userguide/kotlin_dsl.html#type-safe-accessors). + +"Old style" task declarations in the Groovy DSL continue to be eager and force creation/configuration of any tasks created this way. +``` +// "Old style" task declaration uses Task create API. This always creates a task. +task myTask(type: MyTask) { + // This is always called +} +``` + +In Groovy, to use the new API: +``` +tasks.register("myTask", MyTask) { + +} +``` + +The existing API is not deprecated, but as builds transition to the new API, we will consider deprecating the API in a future release. + ## Fixed issues ### Inherited configuration-wide dependency excludes are now published