From a96fc12e5ccde5639ee02bf602febeebf15be1be Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 11:13:25 -0400 Subject: [PATCH 01/40] Remove Closure taking methods from Reporting --- .../api/plugins/quality/Checkstyle.java | 27 ------------------- .../gradle/api/plugins/quality/CodeNarc.java | 10 ------- .../org/gradle/api/plugins/quality/Pmd.java | 12 --------- .../ArtifactRepositoryContainer.java | 2 -- .../HtmlDependencyReportTask.java | 8 ------ .../AbstractConfigurationReportTask.java | 19 +------------ .../testing/jacoco/tasks/JacocoReport.java | 10 ------- .../api/reporting/GenerateBuildDashboard.java | 25 ----------------- .../org/gradle/api/reporting/Reporting.java | 19 ------------- .../api/tasks/testing/AbstractTestTask.java | 12 --------- 10 files changed, 1 insertion(+), 143 deletions(-) diff --git a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Checkstyle.java b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Checkstyle.java index bb18309294924..82a7be1fd8206 100644 --- a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Checkstyle.java +++ b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Checkstyle.java @@ -15,8 +15,6 @@ */ package org.gradle.api.plugins.quality; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.file.DirectoryProperty; @@ -47,7 +45,6 @@ import org.gradle.jvm.toolchain.JavaLauncher; import org.gradle.jvm.toolchain.JavaToolchainService; import org.gradle.jvm.toolchain.internal.CurrentJvmToolchainSpec; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.workers.WorkQueue; import org.gradle.workers.WorkerExecutor; @@ -130,30 +127,6 @@ public WorkerExecutor getWorkerExecutor() { throw new UnsupportedOperationException(); } - /** - * Configures the reports to be generated by this task. - * - * The contained reports can be configured by name and closures. Example: - * - *
-     * checkstyleTask {
-     *   reports {
-     *     html {
-     *       destination "build/checkstyle.html"
-     *     }
-     *   }
-     * }
-     * 
- * - * @param closure The configuration - * @return The reports container - */ - @Override - @SuppressWarnings("rawtypes") - public CheckstyleReports reports(@DelegatesTo(value = CheckstyleReports.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { - return reports(new ClosureBackedAction<>(closure)); - } - /** * Configures the reports to be generated by this task. * diff --git a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/CodeNarc.java b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/CodeNarc.java index eecd997dd8cac..a39212657158c 100644 --- a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/CodeNarc.java +++ b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/CodeNarc.java @@ -15,7 +15,6 @@ */ package org.gradle.api.plugins.quality; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.file.FileCollection; @@ -42,7 +41,6 @@ import org.gradle.jvm.toolchain.JavaLauncher; import org.gradle.jvm.toolchain.JavaToolchainService; import org.gradle.jvm.toolchain.internal.CurrentJvmToolchainSpec; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.workers.WorkQueue; import org.gradle.workers.WorkerExecutor; @@ -167,14 +165,6 @@ private void setupParameters(CodeNarcActionParameters parameters) { parameters.getSource().setFrom(getSource()); } - /** - * Configures the reports to be generated by this task. - */ - @Override - public CodeNarcReports reports(Closure closure) { - return reports(new ClosureBackedAction(closure)); - } - /** * Configures the reports to be generated by this task. */ diff --git a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.java b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.java index d0af7b7309c0c..630b1dbb6881c 100644 --- a/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.java +++ b/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.java @@ -15,8 +15,6 @@ */ package org.gradle.api.plugins.quality; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.InvalidUserDataException; @@ -50,7 +48,6 @@ import org.gradle.jvm.toolchain.JavaLauncher; import org.gradle.jvm.toolchain.JavaToolchainService; import org.gradle.jvm.toolchain.internal.CurrentJvmToolchainSpec; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.workers.WorkQueue; import org.gradle.workers.WorkerExecutor; @@ -182,15 +179,6 @@ public boolean stdOutIsAttachedToTerminal() { } } - /** - * Configures the reports to be generated by this task. - */ - @Override - @SuppressWarnings("rawtypes") - public PmdReports reports(@DelegatesTo(value = PmdReports.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { - return reports(new ClosureBackedAction<>(closure)); - } - /** * Configures the reports to be generated by this task. * diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java index 273b337e73c4f..ff27cef98fcc5 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java @@ -15,8 +15,6 @@ */ package org.gradle.api.artifacts; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.NamedDomainObjectList; import org.gradle.api.artifacts.repositories.ArtifactRepository; diff --git a/subprojects/diagnostics/src/main/java/org/gradle/api/reporting/dependencies/HtmlDependencyReportTask.java b/subprojects/diagnostics/src/main/java/org/gradle/api/reporting/dependencies/HtmlDependencyReportTask.java index 35e4357f1166d..22ba168dcf19e 100644 --- a/subprojects/diagnostics/src/main/java/org/gradle/api/reporting/dependencies/HtmlDependencyReportTask.java +++ b/subprojects/diagnostics/src/main/java/org/gradle/api/reporting/dependencies/HtmlDependencyReportTask.java @@ -16,7 +16,6 @@ package org.gradle.api.reporting.dependencies; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.Project; @@ -35,7 +34,6 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.UntrackedTask; import org.gradle.internal.logging.ConsoleRenderer; -import org.gradle.util.internal.ClosureBackedAction; import javax.inject.Inject; import java.util.Set; @@ -96,12 +94,6 @@ public DependencyReportContainer getReports() { return reports; } - @Override - @SuppressWarnings("rawtypes") - public DependencyReportContainer reports(Closure closure) { - return reports(new ClosureBackedAction<>(closure)); - } - @Override public DependencyReportContainer reports(Action configureAction) { configureAction.execute(reports); diff --git a/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/AbstractConfigurationReportTask.java b/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/AbstractConfigurationReportTask.java index fffbda7b8fe72..eaafbbe74686b 100644 --- a/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/AbstractConfigurationReportTask.java +++ b/subprojects/diagnostics/src/main/java/org/gradle/api/tasks/diagnostics/AbstractConfigurationReportTask.java @@ -16,8 +16,6 @@ package org.gradle.api.tasks.diagnostics; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.DefaultTask; import org.gradle.api.Incubating; @@ -28,15 +26,14 @@ import org.gradle.api.tasks.Nested; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.diagnostics.configurations.ConfigurationReports; -import org.gradle.api.tasks.diagnostics.internal.configurations.model.ConfigurationReportModelFactory; import org.gradle.api.tasks.diagnostics.internal.configurations.ConfigurationReportsImpl; import org.gradle.api.tasks.diagnostics.internal.configurations.model.ConfigurationReportModel; +import org.gradle.api.tasks.diagnostics.internal.configurations.model.ConfigurationReportModelFactory; import org.gradle.api.tasks.diagnostics.internal.configurations.renderer.ConsoleConfigurationReportRenderer; import org.gradle.api.tasks.diagnostics.internal.configurations.spec.AbstractConfigurationReportSpec; import org.gradle.internal.logging.text.StyledTextOutput; import org.gradle.internal.logging.text.StyledTextOutputFactory; import org.gradle.internal.serialization.Cached; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.work.DisableCachingByDefault; import javax.inject.Inject; @@ -73,20 +70,6 @@ public final ConfigurationReports getReports() { return reports; } - /** - * Configures the reports to be generated by this task. - * - * The contained reports can be configured by task name and closures. - * - * @param closure The configuration - * @return The reports container - */ - @Override - @SuppressWarnings("rawtypes") - public ConfigurationReports reports(@DelegatesTo(value = ConfigurationReports.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { - return reports(new ClosureBackedAction<>(closure)); - } - /** * Configures the reports to be generated by this task. * diff --git a/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/tasks/JacocoReport.java b/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/tasks/JacocoReport.java index 0be30fd7a4139..9b95da9d3b7bc 100644 --- a/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/tasks/JacocoReport.java +++ b/subprojects/jacoco/src/main/java/org/gradle/testing/jacoco/tasks/JacocoReport.java @@ -15,7 +15,6 @@ */ package org.gradle.testing.jacoco.tasks; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.provider.Property; import org.gradle.api.reporting.Reporting; @@ -25,7 +24,6 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.internal.jacoco.AntJacocoReport; import org.gradle.internal.jacoco.JacocoReportsContainerImpl; -import org.gradle.util.internal.ClosureBackedAction; import java.io.File; @@ -64,14 +62,6 @@ public JacocoReportsContainer getReports() { return reports; } - /** - * Configures the reports to be generated by this task. - */ - @Override - public JacocoReportsContainer reports(Closure closure) { - return reports(new ClosureBackedAction(closure)); - } - @Override public JacocoReportsContainer reports(Action configureAction) { configureAction.execute(reports); diff --git a/subprojects/reporting/src/main/java/org/gradle/api/reporting/GenerateBuildDashboard.java b/subprojects/reporting/src/main/java/org/gradle/api/reporting/GenerateBuildDashboard.java index cabbb361cd953..8d7df969a607e 100644 --- a/subprojects/reporting/src/main/java/org/gradle/api/reporting/GenerateBuildDashboard.java +++ b/subprojects/reporting/src/main/java/org/gradle/api/reporting/GenerateBuildDashboard.java @@ -17,7 +17,6 @@ package org.gradle.api.reporting; import com.google.common.collect.Sets; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.DefaultTask; import org.gradle.api.NamedDomainObjectSet; @@ -32,7 +31,6 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.internal.Cast; import org.gradle.internal.reflect.Instantiator; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.util.internal.CollectionUtils; import org.gradle.work.DisableCachingByDefault; @@ -142,29 +140,6 @@ public BuildDashboardReports getReports() { return reports; } - /** - * Configures the reports to be generated by this task. - * - * The contained reports can be configured by name and closures. - * - *
-     * buildDashboard {
-     *   reports {
-     *     html {
-     *       destination "build/dashboard.html"
-     *     }
-     *   }
-     * }
-     * 
- * - * @param closure The configuration - * @return The reports container - */ - @Override - public BuildDashboardReports reports(Closure closure) { - return reports(new ClosureBackedAction(closure)); - } - /** * Configures the reports to be generated by this task. * diff --git a/subprojects/reporting/src/main/java/org/gradle/api/reporting/Reporting.java b/subprojects/reporting/src/main/java/org/gradle/api/reporting/Reporting.java index 5eb7fc4f81cb7..65fab0591b22d 100644 --- a/subprojects/reporting/src/main/java/org/gradle/api/reporting/Reporting.java +++ b/subprojects/reporting/src/main/java/org/gradle/api/reporting/Reporting.java @@ -16,8 +16,6 @@ package org.gradle.api.reporting; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; /** @@ -68,23 +66,6 @@ public interface Reporting { */ T getReports(); - /** - * Allow configuration of the report container by closure. - * - *
-     * reports {
-     *   html {
-     *     enabled false
-     *   }
-     *   xml.destination "build/reports/myReport.xml"
-     * }
-     * 
- * - * @param closure The configuration - * @return The report container - */ - T reports(@DelegatesTo(type="T", strategy = Closure.DELEGATE_FIRST) Closure closure); - /** * Allow configuration of the report container by closure. * diff --git a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java index 1a054316312ed..f987b93ae8c71 100644 --- a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java +++ b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java @@ -76,7 +76,6 @@ import org.gradle.internal.operations.BuildOperationExecutor; import org.gradle.internal.reflect.Instantiator; import org.gradle.listener.ClosureBackedMethodInvocationDispatch; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.util.internal.ConfigureUtil; import org.gradle.work.DisableCachingByDefault; @@ -571,17 +570,6 @@ public TestTaskReports getReports() { return reports; } - /** - * Configures the reports that this task potentially produces. - * - * @param closure The configuration - * @return The reports that this task potentially produces - */ - @Override - public TestTaskReports reports(Closure closure) { - return reports(new ClosureBackedAction(closure)); - } - /** * Configures the reports that this task potentially produces. * From 06f42e5d638a520a4b66c708941f36ea90b1b3a5 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 12:35:39 -0400 Subject: [PATCH 02/40] Remove Closure taking query methods from DomainObjectCollections This leaves some Closure taking methods: - configure(Closure) - create(..., Closure) - any sub-type specific Closure methods This is source incompatible, but runtime compatible due to decoration --- .../gradle/api/DomainObjectCollection.java | 65 ++--------- .../java/org/gradle/api/DomainObjectSet.java | 9 +- .../api/NamedDomainObjectCollection.java | 30 +---- .../org/gradle/api/NamedDomainObjectList.java | 9 +- .../org/gradle/api/NamedDomainObjectSet.java | 9 +- .../ArtifactRepositoryContainer.java | 8 +- .../api/artifacts/ConfigurationContainer.java | 12 +- .../gradle/api/plugins/PluginCollection.java | 6 - .../org/gradle/api/tasks/TaskCollection.java | 19 +--- ...omainObjectContainerIntegrationTest.groovy | 2 +- .../DefaultDomainObjectCollection.java | 40 +------ .../api/internal/DefaultDomainObjectSet.java | 7 +- .../DefaultNamedDomainObjectCollection.java | 22 ---- .../DefaultNamedDomainObjectList.java | 9 +- .../internal/DefaultNamedDomainObjectSet.java | 9 +- .../internal/DelegatingDomainObjectSet.java | 30 +---- .../TypedDomainObjectContainerWrapper.java | 40 +------ .../plugins/DefaultPluginCollection.java | 9 +- .../DefaultRealizableTaskCollection.java | 43 +------ .../internal/tasks/DefaultTaskCollection.java | 12 -- .../internal/tasks/DefaultTaskContainer.java | 5 - .../DefaultDomainObjectCollectionTest.groovy | 105 ------------------ .../task_configuration_avoidance.adoc | 13 +-- .../NamedDomainObjectContainerDelegate.kt | 23 +--- .../delegates/TaskContainerDelegate.kt | 26 +---- .../BinaryTasksCollectionWrapper.java | 34 +----- 26 files changed, 42 insertions(+), 554 deletions(-) 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 64ffe37357a53..7410f26826970 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 @@ -25,7 +25,7 @@ /** *

A {@code DomainObjectCollection} is a specialised {@link Collection} that adds the ability to receive modification notifications and use live filtered sub collections.

* - *

The filtered collections returned by the filtering methods, such as {@link #matching(Closure)}, return collections that are live. That is, they reflect + *

The filtered collections returned by the filtering methods, such as {@link #matching(Spec)}, return collections that are live. That is, they reflect * changes made to the source collection that they were created from. This is true for filtered collections made from filtered collections etc.

*

* You can also add actions that are executed as elements are added to the collection. Actions added to filtered collections will be fired if an addition/removal @@ -74,16 +74,6 @@ public interface DomainObjectCollection extends Collection { */ DomainObjectCollection withType(Class type, Action configureAction); - /** - * Returns a collection containing the objects in this collection of the given type. Equivalent to calling - * {@code withType(type).all(configureClosure)}. - * - * @param type The type of objects to find. - * @param configureClosure The closure to execute for each object in the resulting collection. - * @return The matching objects. Returns an empty collection if there are no such objects in this collection. - */ - DomainObjectCollection withType(@DelegatesTo.Target Class type, @DelegatesTo(genericTypeIndex = 0) Closure configureClosure); - /** * Returns a collection which contains the objects in this collection which meet the given specification. The * returned collection is live, so that when matching objects are added to this collection, they are also visible in @@ -95,17 +85,6 @@ public interface DomainObjectCollection extends Collection { */ DomainObjectCollection matching(Spec spec); - /** - * Returns a collection which contains the objects in this collection which meet the given closure specification. The - * returned collection is live, so that when matching objects are added to this collection, they are also visible in - * the filtered collection. - * - * @param spec The specification to use. The closure gets a collection element as an argument. - * @return The collection of matching objects. Returns an empty collection if there are no such objects in this - * collection. - */ - DomainObjectCollection matching(Closure spec); - /** * Adds an {@code Action} to be executed when an object is added to this collection. *

@@ -116,15 +95,6 @@ public interface DomainObjectCollection extends Collection { */ Action whenObjectAdded(Action action); - /** - * Adds a closure to be called when an object is added to this collection. The newly added object is passed to the - * closure as the parameter. - * - * @param action The closure to be called - * @see #whenObjectAdded(Action) - */ - void whenObjectAdded(Closure action); - /** * Adds an {@code Action} to be executed when an object is removed from this collection. * @@ -133,14 +103,6 @@ public interface DomainObjectCollection extends Collection { */ Action whenObjectRemoved(Action action); - /** - * Adds a closure to be called when an object is removed from this collection. The removed object is passed to the - * closure as the parameter. - * - * @param action The closure to be called - */ - void whenObjectRemoved(Closure action); - /** * Executes the given action against all objects in this collection, and any objects subsequently added to this * collection. @@ -149,14 +111,6 @@ public interface DomainObjectCollection extends Collection { */ void all(Action action); - /** - * Executes the given closure against all objects in this collection, and any objects subsequently added to this collection. The object is passed to the closure as the closure - * delegate. Alternatively, it is also passed as a parameter. - * - * @param action The action to be executed - */ - void all(Closure action); - /** * Configures each element in this collection using the given action, as each element is required. Actions are run in the order added. * @@ -165,13 +119,18 @@ public interface DomainObjectCollection extends Collection { */ void configureEach(Action action); - // note: this is here to override the default Groovy Collection.findAll { } method. + // Do not delete! + // This is here to override the default Groovy Collection.findAll(Closure) method. /** - * Returns a collection which contains the objects in this collection which meet the given closure specification. + * Returns a collection which contains the objects in this collection which meet the given specification. + *

+ * NOTE: This eagerly iterates over the collection. Elements added after this method is called will not be present in the returned Collection. + * You should use {@link #matching(Spec)} for a lazy equivalent. + *

* - * @param spec The specification to use. The closure gets a collection element as an argument. - * @return The collection of matching objects. Returns an empty collection if there are no such objects in this - * collection. + * @param spec The specification to use. The specification gets a collection element as an argument. + * @return The collection of matching objects. Returns an empty collection if there are no such objects in this collection. + * @see #matching(Spec) */ - Collection findAll(Closure spec); + Collection findAll(Spec spec); } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectSet.java b/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectSet.java index 18b68a75a69d1..59c124bce5b69 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectSet.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/DomainObjectSet.java @@ -15,7 +15,6 @@ */ package org.gradle.api; -import groovy.lang.Closure; import org.gradle.api.specs.Spec; import java.util.Set; @@ -45,11 +44,5 @@ public interface DomainObjectSet extends DomainObjectCollection, Set { * {@inheritDoc} */ @Override - DomainObjectSet matching(Closure spec); - - /** - * {@inheritDoc} - */ - @Override - Set findAll(Closure spec); + Set findAll(Spec spec); } 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 243a17c212b77..d5009d4b46c08 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 @@ -15,7 +15,6 @@ */ package org.gradle.api; -import groovy.lang.Closure; import org.gradle.api.provider.Provider; import org.gradle.api.specs.Spec; import org.gradle.api.tasks.Internal; @@ -46,7 +45,7 @@ * * *

A dynamic method is added for each object which takes a configuration closure. This is equivalent to calling - * {@link #getByName(String, groovy.lang.Closure)}. For example:

+ * {@link #getByName(String, org.gradle.api.Action)}. For example:

* *
  * books.add(new Book(name: "gradle", title: null))
@@ -136,17 +135,6 @@ public interface NamedDomainObjectCollection extends DomainObjectCollection extends DomainObjectCollection extends DomainObjectCollection matching(Spec spec);
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    NamedDomainObjectCollection matching(Closure spec);
-
     /**
      * Locates a object by name, without triggering its creation or configuration, failing if there is no such object.
      *
diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectList.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectList.java
index 1763c40d103fd..39c653deea01b 100644
--- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectList.java
+++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectList.java
@@ -15,7 +15,6 @@
  */
 package org.gradle.api;
 
-import groovy.lang.Closure;
 import org.gradle.api.specs.Spec;
 
 import java.util.List;
@@ -48,11 +47,5 @@ public interface NamedDomainObjectList extends NamedDomainObjectCollection
      * {@inheritDoc}
      */
     @Override
-    NamedDomainObjectList matching(Closure spec);
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    List findAll(Closure spec);
+    List findAll(Spec spec);
 }
diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectSet.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectSet.java
index 74bb010a289c5..b52d4c321153c 100755
--- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectSet.java
+++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectSet.java
@@ -15,7 +15,6 @@
  */
 package org.gradle.api;
 
-import groovy.lang.Closure;
 import org.gradle.api.specs.Spec;
 
 import java.util.Set;
@@ -49,11 +48,5 @@ public interface NamedDomainObjectSet extends NamedDomainObjectCollection,
      * {@inheritDoc}
      */
     @Override
-    NamedDomainObjectSet matching(Closure spec);
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    Set findAll(Closure spec);
+    Set findAll(Spec spec);
 }
diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java
index ff27cef98fcc5..82632577a49a7 100644
--- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java
+++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ArtifactRepositoryContainer.java
@@ -35,7 +35,7 @@
  * 
* *

A dynamic method is added for each resolver which takes a configuration closure. This is equivalent to calling - * {@link #getByName(String, groovy.lang.Closure)}. For example:

+ * {@link #getByName(String, Action)}. For example:

* *
  * repositories.maven { name 'myResolver' }
@@ -78,12 +78,6 @@ public interface ArtifactRepositoryContainer extends NamedDomainObjectList
  *
- * 

A dynamic method is added for each configuration which takes a configuration closure. This is equivalent to - * calling {@link #getByName(String, groovy.lang.Closure)}. For example:

+ *

A dynamic method is added for each configuration which takes a configuration action. This is equivalent to + * calling {@link #getByName(String, Action)}. For example:

* *
  * configurations.create('myConfiguration')
@@ -105,12 +103,6 @@ public interface ConfigurationContainer extends NamedDomainObjectContainer extends DomainObjectSet {
     @Override
     PluginCollection matching(Spec spec);
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    PluginCollection matching(Closure closure);
-
     /**
      * {@inheritDoc}
      */
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 ecc94812c9fac..0af2a4ce72e87 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
@@ -39,14 +39,7 @@ public interface TaskCollection extends NamedDomainObjectSet
     /**
      * {@inheritDoc}
      */
-    @Override
-    TaskCollection matching(Closure closure);
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    T getByName(String name, Closure configureClosure) throws UnknownTaskException;
+    T getByName(String name, Action action) throws UnknownTaskException;
 
     /**
      * {@inheritDoc}
@@ -72,16 +65,6 @@ public interface TaskCollection extends NamedDomainObjectSet
     @SuppressWarnings("UnusedDeclaration")
     Action whenTaskAdded(Action action);
 
-    /**
-     * Adds a closure to be called when a task is added to this collection. The task is passed to the closure as the
-     * parameter.
-     *
-     * @param closure The closure to be called
-     * @see #whenTaskAdded(Action)
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    void whenTaskAdded(Closure closure);
-
     /**
      * {@inheritDoc}
      */
diff --git a/subprojects/core/src/integTest/groovy/org/gradle/api/AbstractDomainObjectContainerIntegrationTest.groovy b/subprojects/core/src/integTest/groovy/org/gradle/api/AbstractDomainObjectContainerIntegrationTest.groovy
index 8651ae90a9aae..f04ce879bd8dd 100644
--- a/subprojects/core/src/integTest/groovy/org/gradle/api/AbstractDomainObjectContainerIntegrationTest.groovy
+++ b/subprojects/core/src/integTest/groovy/org/gradle/api/AbstractDomainObjectContainerIntegrationTest.groovy
@@ -56,7 +56,7 @@ abstract class AbstractDomainObjectContainerIntegrationTest extends AbstractInte
             "${containerType}#getByName(String)":    "testContainer.getByName('unrealized')",
             "${containerType}#named(String)":        "testContainer.named('unrealized')",
             "${containerType}#named(String, Class)": "testContainer.named('unrealized', testContainer.type)",
-            "${containerType}#findAll(Closure)":     "testContainer.findAll { it.name == 'unrealized' }",
+            "${containerType}#findAll(Spec)":     "testContainer.findAll { it.name == 'unrealized' }",
             "${containerType}#findByName(String)":   "testContainer.findByName('unrealized')",
             "${containerType}#TaskProvider.get()":   "unrealized.get()",
             "${containerType}#iterator()":           "for (def element : testContainer) { println element.name }",
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectCollection.java
index d2a75d08f4f73..6bcd517815e6e 100755
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectCollection.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectCollection.java
@@ -16,7 +16,6 @@
 package org.gradle.api.internal;
 
 import com.google.common.collect.Lists;
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.DomainObjectCollection;
 import org.gradle.api.internal.collections.CollectionEventRegister;
@@ -31,9 +30,7 @@
 import org.gradle.api.internal.provider.Providers;
 import org.gradle.api.provider.Provider;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
 import org.gradle.internal.Cast;
-import org.gradle.util.internal.ConfigureUtil;
 
 import java.util.AbstractCollection;
 import java.util.ArrayList;
@@ -113,11 +110,6 @@ public DomainObjectCollection matching(final Spec spec) {
         return filtered(createFilter(spec));
     }
 
-    @Override
-    public DomainObjectCollection matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public  DomainObjectCollection withType(final Class type) {
         return filtered(createFilter(type));
@@ -191,11 +183,6 @@ protected  Action withMutationDisabled(Action
         return getMutationGuard().withMutationDisabled(action);
     }
 
-    @Override
-    public void all(Closure action) {
-        all(toAction(action));
-    }
-
     @Override
     public  DomainObjectCollection withType(Class type, Action configureAction) {
         assertMutable("withType(Class, Action)");
@@ -204,22 +191,12 @@ public  DomainObjectCollection withType(Class type, Action DomainObjectCollection withType(Class type, Closure configureClosure) {
-        return withType(type, toAction(configureClosure));
-    }
-
     @Override
     public Action whenObjectAdded(Action action) {
         assertMutable("whenObjectAdded(Action)");
         return addEagerAction(action);
     }
 
-    @Override
-    public void whenObjectAdded(Closure action) {
-        whenObjectAdded(toAction(action));
-    }
-
     private Action addEagerAction(Action action) {
         store.realizePending(type);
         return eventRegister.registerEagerAddAction(type, decorate(action));
@@ -231,19 +208,10 @@ public Action whenObjectRemoved(Action action) {
         return action;
     }
 
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        whenObjectRemoved(toAction(action));
-    }
-
     private Action decorate(Action action) {
         return eventRegister.getDecorator().decorate(action);
     }
 
-    private Action toAction(Closure action) {
-        return ConfigureUtil.configureUsing(action);
-    }
-
     @Override
     public boolean add(T toAdd) {
         assertMutable("add(T)");
@@ -437,15 +405,15 @@ public MutationGuard getMutationGuard() {
     }
 
     @Override
-    public Collection findAll(Closure cl) {
-        return findAll(cl, new ArrayList());
+    public Collection findAll(Spec spec) {
+        return findAll(spec, new ArrayList());
     }
 
-    protected > S findAll(Closure cl, S matches) {
+    protected > S findAll(Spec spec, S matches) {
         if (store.constantTimeIsEmpty()) {
             return matches;
         }
-        for (T t : filteredStore(createFilter(Specs.convertClosureToSpec(cl)))) {
+        for (T t : filteredStore(createFilter(spec))) {
             matches.add(t);
         }
         return matches;
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java
index f1e5dd37801dc..433861ff70cf8 100755
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java
@@ -85,12 +85,7 @@ public DomainObjectSet matching(Spec spec) {
     }
 
     @Override
-    public DomainObjectSet matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
-    @Override
-    public Set findAll(Closure cl) {
+    public Set findAll(Spec cl) {
         return findAll(cl, new LinkedHashSet());
     }
 }
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java
index 5436344cdb846..7a56d4924cf62 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java
@@ -278,11 +278,6 @@ public NamedDomainObjectCollection matching(Spec spec) {
         return filtered(createFilter(spec));
     }
 
-    @Override
-    public NamedDomainObjectCollection matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public T findByName(String name) {
         T value = findByNameWithoutRules(name);
@@ -334,12 +329,6 @@ public T getByName(String name) throws UnknownDomainObjectException {
         }
         return t;
     }
-
-    @Override
-    public T getByName(String name, Closure configureClosure) throws UnknownDomainObjectException {
-        return getByName(name, ConfigureUtil.configureUsing(configureClosure));
-    }
-
     @Override
     public T getByName(String name, Action configureAction) throws UnknownDomainObjectException {
         assertMutable("getByName(String, Action)");
@@ -455,17 +444,6 @@ public Rule addRule(Rule rule) {
         rules.add(rule);
         return rule;
     }
-
-    @Override
-    public Rule addRule(final String description, final Closure ruleAction) {
-        return addRule(new RuleAdapter(description) {
-            @Override
-            public void apply(String domainObjectName) {
-                ruleAction.call(domainObjectName);
-            }
-        });
-    }
-
     @Override
     public Rule addRule(final String description, final Action ruleAction) {
         return addRule(new RuleAdapter(description) {
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectList.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectList.java
index 6d49c95eb2705..838340665f785 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectList.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectList.java
@@ -15,7 +15,6 @@
  */
 package org.gradle.api.internal;
 
-import groovy.lang.Closure;
 import org.gradle.api.NamedDomainObjectList;
 import org.gradle.api.Namer;
 import org.gradle.api.internal.collections.CollectionFilter;
@@ -24,7 +23,6 @@
 import org.gradle.api.internal.collections.IndexedElementSource;
 import org.gradle.api.internal.collections.ListElementSource;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
 import org.gradle.internal.reflect.Instantiator;
 
 import java.util.ArrayList;
@@ -133,11 +131,6 @@ protected  IndexedElementSource filteredStore(CollectionFilter(elementSource, filter);
     }
 
-    @Override
-    public NamedDomainObjectList matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public NamedDomainObjectList matching(Spec spec) {
         return new DefaultNamedDomainObjectList(this, createFilter(spec), getInstantiator(), getNamer());
@@ -149,7 +142,7 @@ public  NamedDomainObjectList withType(Class type) {
     }
 
     @Override
-    public List findAll(Closure cl) {
+    public List findAll(Spec cl) {
         return findAll(cl, new ArrayList());
     }
 
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectSet.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectSet.java
index 53439ea81c135..14206d3b70aa4 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectSet.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectSet.java
@@ -15,7 +15,6 @@
  */
 package org.gradle.api.internal;
 
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.Named;
 import org.gradle.api.NamedDomainObjectSet;
@@ -23,7 +22,6 @@
 import org.gradle.api.internal.collections.CollectionFilter;
 import org.gradle.api.internal.collections.SortedSetElementSource;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
 import org.gradle.internal.Cast;
 import org.gradle.internal.reflect.Instantiator;
 
@@ -73,12 +71,7 @@ public NamedDomainObjectSet matching(Spec spec) {
     }
 
     @Override
-    public NamedDomainObjectSet matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
-    @Override
-    public Set findAll(Closure cl) {
+    public Set findAll(Spec cl) {
         return findAll(cl, new LinkedHashSet());
     }
 
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DelegatingDomainObjectSet.java b/subprojects/core/src/main/java/org/gradle/api/internal/DelegatingDomainObjectSet.java
index ea55a2612f017..509eb21c61c8f 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/DelegatingDomainObjectSet.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/DelegatingDomainObjectSet.java
@@ -15,14 +15,11 @@
  */
 package org.gradle.api.internal;
 
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.DomainObjectCollection;
 import org.gradle.api.DomainObjectSet;
 import org.gradle.api.provider.Provider;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
-import org.gradle.util.internal.ConfigureUtil;
 
 import java.util.Collection;
 import java.util.Iterator;
@@ -35,11 +32,6 @@ public DelegatingDomainObjectSet(DomainObjectSet backingSet) {
         this.backingSet = backingSet;
     }
 
-    @Override
-    public DomainObjectSet matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public DomainObjectSet matching(Spec spec) {
         return backingSet.matching(spec);
@@ -55,11 +47,6 @@ public void all(Action action) {
         backingSet.all(action);
     }
 
-    @Override
-    public void all(Closure action) {
-        all(ConfigureUtil.configureUsing(action));
-    }
-
     @Override
     public void configureEach(Action action) {
         backingSet.configureEach(action);
@@ -70,31 +57,16 @@ public Action whenObjectAdded(Action action) {
         return backingSet.whenObjectAdded(action);
     }
 
-    @Override
-    public void whenObjectAdded(Closure action) {
-        whenObjectAdded(ConfigureUtil.configureUsing(action));
-    }
-
     @Override
     public Action whenObjectRemoved(Action action) {
         return backingSet.whenObjectRemoved(action);
     }
 
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        whenObjectRemoved(ConfigureUtil.configureUsing(action));
-    }
-
     @Override
     public  DomainObjectCollection withType(Class type, Action configureAction) {
         return backingSet.withType(type, configureAction);
     }
 
-    @Override
-    public  DomainObjectCollection withType(Class type, Closure configureClosure) {
-        return withType(type, ConfigureUtil.configureUsing(configureClosure));
-    }
-
     @Override
     public void addLater(Provider provider) {
         backingSet.addLater(provider);
@@ -171,7 +143,7 @@ public  T[] toArray(T[] a) {
     }
 
     @Override
-    public Set findAll(Closure spec) {
+    public Set findAll(Spec spec) {
         return backingSet.findAll(spec);
     }
 }
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java b/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java
index 6fa6b8e43b168..3e30802d98321 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java
@@ -100,15 +100,10 @@ public NamedDomainObjectProvider register(String name) throws InvalidUserData
     }
 
     @Override
-    public Set findAll(Closure spec) {
+    public Set findAll(Spec spec) {
         return delegate.findAll(spec);
     }
 
-    @Override
-    public NamedDomainObjectSet matching(Closure spec) {
-        return delegate.matching(spec);
-    }
-
     @Override
     public NamedDomainObjectProvider named(String name) throws UnknownDomainObjectException {
         return delegate.named(name);
@@ -158,12 +153,6 @@ public void addAllLater(Provider> provider) {
     public boolean addAll(Collection c) {
         return delegate.addAll(c);
     }
-
-    @Override
-    public Rule addRule(String description, Closure ruleAction) {
-        return delegate.addRule(description, ruleAction);
-    }
-
     @Override
     public Rule addRule(String description, Action ruleAction) {
         return delegate.addRule(description, ruleAction);
@@ -198,12 +187,6 @@ public U getAt(String name) throws UnknownDomainObjectException {
     public U getByName(String name) throws UnknownDomainObjectException {
         return delegate.getByName(name);
     }
-
-    @Override
-    public U getByName(String name, Closure configureClosure) throws UnknownDomainObjectException {
-        return delegate.getByName(name, configureClosure);
-    }
-
     @Override
     public U getByName(String name, Action configureAction) throws UnknownDomainObjectException {
         return delegate.getByName(name, configureAction);
@@ -229,10 +212,6 @@ public void all(Action action) {
         delegate.all(action);
     }
 
-    @Override
-    public void all(Closure action) {
-        delegate.all(action);
-    }
 
     @Override
     public void configureEach(Action action) {
@@ -243,32 +222,15 @@ public void configureEach(Action action) {
     public Action whenObjectAdded(Action action) {
         return delegate.whenObjectAdded(action);
     }
-
-    @Override
-    public void whenObjectAdded(Closure action) {
-        delegate.whenObjectAdded(action);
-    }
-
     @Override
     public Action whenObjectRemoved(Action action) {
         return delegate.whenObjectRemoved(action);
     }
-
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        delegate.whenObjectRemoved(action);
-    }
-
     @Override
     public  DomainObjectCollection withType(Class type, Action configureAction) {
         return delegate.withType(type, configureAction);
     }
 
-    @Override
-    public  DomainObjectCollection withType(Class type, Closure configureClosure) {
-        return delegate.withType(type, configureClosure);
-    }
-
     @Override
     public void clear() {
         delegate.clear();
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java
index 8ed960d241b2a..1d5389cbea734 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java
@@ -23,7 +23,7 @@
 import org.gradle.api.internal.collections.CollectionFilter;
 import org.gradle.api.plugins.PluginCollection;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
+import org.gradle.util.internal.ConfigureUtil;
 
 import java.util.Collection;
 
@@ -72,11 +72,6 @@ public PluginCollection matching(Spec spec) {
         return filtered(createFilter(spec));
     }
 
-    @Override
-    public PluginCollection matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public Action whenPluginAdded(Action action) {
         return whenObjectAdded(action);
@@ -84,7 +79,7 @@ public Action whenPluginAdded(Action action) {
 
     @Override
     public void whenPluginAdded(Closure closure) {
-        whenObjectAdded(closure);
+        whenObjectAdded(ConfigureUtil.configureUsing(closure));
     }
 
 }
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultRealizableTaskCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultRealizableTaskCollection.java
index f444f5ad2244a..190c35f527041 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultRealizableTaskCollection.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultRealizableTaskCollection.java
@@ -16,7 +16,6 @@
 
 package org.gradle.api.internal.tasks;
 
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.DomainObjectCollection;
 import org.gradle.api.InvalidUserDataException;
@@ -84,16 +83,6 @@ public TaskCollection matching(Spec spec) {
         return realizable(type, delegate.matching(spec));
     }
 
-    @Override
-    public TaskCollection matching(Closure closure) {
-        return realizable(type, delegate.matching(closure));
-    }
-
-    @Override
-    public T getByName(String name, Closure configureClosure) throws UnknownTaskException {
-        return delegate.getByName(name, configureClosure);
-    }
-
     @Override
     public T getByName(String name, Action configureAction) throws UnknownTaskException {
         return delegate.getByName(name, configureAction);
@@ -114,18 +103,13 @@ public Action whenTaskAdded(Action action) {
         return delegate.whenTaskAdded(action);
     }
 
-    @Override
-    public void whenTaskAdded(Closure closure) {
-        delegate.whenTaskAdded(closure);
-    }
-
     @Override
     public T getAt(String name) throws UnknownTaskException {
         return delegate.getAt(name);
     }
 
     @Override
-    public Set findAll(Closure spec) {
+    public Set findAll(Spec spec) {
         return delegate.findAll(spec);
     }
 
@@ -174,11 +158,6 @@ public Rule addRule(Rule rule) {
         return delegate.addRule(rule);
     }
 
-    @Override
-    public Rule addRule(String description, Closure ruleAction) {
-        return delegate.addRule(description, ruleAction);
-    }
-
     @Override
     public Rule addRule(String description, Action ruleAction) {
         return delegate.addRule(description, ruleAction);
@@ -194,41 +173,21 @@ public  DomainObjectCollection withType(Class type, Action) delegate.withType(type, configureAction));
     }
 
-    @Override
-    public  DomainObjectCollection withType(Class type, Closure configureClosure) {
-        return realizable(type, (DefaultTaskCollection) delegate.withType(type, configureClosure));
-    }
-
     @Override
     public Action whenObjectAdded(Action action) {
         return delegate.whenObjectAdded(action);
     }
 
-    @Override
-    public void whenObjectAdded(Closure action) {
-        delegate.whenObjectAdded(action);
-    }
-
     @Override
     public Action whenObjectRemoved(Action action) {
         return delegate.whenObjectRemoved(action);
     }
 
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        delegate.whenObjectRemoved(action);
-    }
-
     @Override
     public void all(Action action) {
         delegate.all(action);
     }
 
-    @Override
-    public void all(Closure action) {
-        delegate.all(action);
-    }
-
     @Override
     public void configureEach(Action action) {
         delegate.configureEach(action);
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskCollection.java
index f3b5ab1667de3..af8ffcc2e6d4d 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskCollection.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskCollection.java
@@ -17,7 +17,6 @@
 
 import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.InvalidUserDataException;
 import org.gradle.api.NamedDomainObjectCollectionSchema;
@@ -32,7 +31,6 @@
 import org.gradle.api.internal.provider.ProviderInternal;
 import org.gradle.api.reflect.TypeOf;
 import org.gradle.api.specs.Spec;
-import org.gradle.api.specs.Specs;
 import org.gradle.api.tasks.TaskCollection;
 import org.gradle.api.tasks.TaskProvider;
 import org.gradle.internal.Cast;
@@ -77,21 +75,11 @@ public TaskCollection matching(Spec spec) {
         return filtered(createFilter(spec));
     }
 
-    @Override
-    public TaskCollection matching(Closure spec) {
-        return matching(Specs.convertClosureToSpec(spec));
-    }
-
     @Override
     public Action whenTaskAdded(Action action) {
         return whenObjectAdded(action);
     }
 
-    @Override
-    public void whenTaskAdded(Closure closure) {
-        whenObjectAdded(closure);
-    }
-
     @Override
     public String getTypeDisplayName() {
         return "task";
diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java
index 8178ac447633c..b41d5b4d105e9 100644
--- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java
+++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java
@@ -645,11 +645,6 @@ public Action whenObjectRemoved(Action action) {
         throw new UnsupportedOperationException("Registering actions on task removal is not supported.");
     }
 
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        throw new UnsupportedOperationException("Registering actions on task removal is not supported.");
-    }
-
     // Cannot be private due to reflective instantiation
     public class TaskCreatingProvider extends AbstractDomainObjectCreatingProvider implements TaskProvider {
         private final TaskIdentity identity;
diff --git a/subprojects/core/src/test/groovy/org/gradle/api/internal/DefaultDomainObjectCollectionTest.groovy b/subprojects/core/src/test/groovy/org/gradle/api/internal/DefaultDomainObjectCollectionTest.groovy
index 56e411711f45e..0ea4da94a081d 100644
--- a/subprojects/core/src/test/groovy/org/gradle/api/internal/DefaultDomainObjectCollectionTest.groovy
+++ b/subprojects/core/src/test/groovy/org/gradle/api/internal/DefaultDomainObjectCollectionTest.groovy
@@ -70,17 +70,12 @@ class DefaultDomainObjectCollectionTest extends AbstractDomainObjectCollectionSp
                 return element != "b"
             }
         }
-        def testClosure = {
-            return it != "b"
-        }
-
         container.add("a")
         container.add("b")
         container.add("c")
 
         expect:
         toList(container.matching(spec)) == ["a", "c"]
-        toList(container.matching(testClosure)) == ["a", "c"]
     }
 
     def filteredCollectionIsLive() {
@@ -127,32 +122,6 @@ class DefaultDomainObjectCollectionTest extends AbstractDomainObjectCollectionSp
         0 * action._
     }
 
-    def filteredCollectionExecutesClosureWhenMatchingObjectAdded() {
-        def seen = []
-        def closure = { seen << it }
-
-        def spec = new Spec() {
-            boolean isSatisfiedBy(CharSequence element) {
-                return element != "a"
-            }
-        }
-
-        given:
-        container.matching(spec).whenObjectAdded(closure)
-
-        when:
-        container.add("a")
-
-        then:
-        seen.empty
-
-        when:
-        container.add("b")
-
-        then:
-        seen == ["b"]
-    }
-
     def canChainFilteredCollections() {
         def spec = new Spec() {
             boolean isSatisfiedBy(CharSequence element) {
@@ -236,47 +205,6 @@ class DefaultDomainObjectCollectionTest extends AbstractDomainObjectCollectionSp
         0 * action._
     }
 
-    def callsClosureWithNewObjectAsParameterWhenObjectAdded() {
-        def seen = []
-        def closure = { seen << it }
-
-        container.whenObjectAdded(closure)
-
-        when:
-        container.add("a")
-
-        then:
-        seen == ["a"]
-    }
-
-    def callsClosureWithRemovedObjectAsParameterWhenObjectRemoved() {
-        def seen = []
-        def closure = { seen << it }
-
-        container.add("a");
-        container.whenObjectRemoved(closure)
-
-        when:
-        container.remove("a")
-
-        then:
-        seen == ["a"]
-
-        when:
-        container.remove("a")
-        container.remove("b")
-
-        then:
-        seen == ["a"]
-    }
-
-    def callsClosureWithNewObjectAsDelegateWhenObjectAdded() {
-        container.whenObjectAdded { assert delegate == 'a' }
-
-        expect:
-        container.add("a")
-    }
-
     def callsRemoveActionWhenObjectRemoved() {
         def action = Mock(Action)
 
@@ -361,20 +289,6 @@ class DefaultDomainObjectCollectionTest extends AbstractDomainObjectCollectionSp
         0 * action._
     }
 
-    def allCallsClosureForEachExistingObject() {
-        def seen = []
-        def closure = { seen << it }
-
-        container.add("a")
-        container.add("b")
-
-        when:
-        container.all(closure)
-
-        then:
-        seen == ["a", "b"]
-    }
-
     def allCallsActionForEachNewObject() {
         def action = Mock(Action)
 
@@ -388,25 +302,6 @@ class DefaultDomainObjectCollectionTest extends AbstractDomainObjectCollectionSp
         0 * action._
     }
 
-    def allCallsClosureForEachNewObject() {
-        def seen = []
-        def closure = { seen << it }
-
-        container.all(closure)
-
-        when:
-        container.add("a")
-
-        then:
-        seen == ["a"]
-    }
-
-    def allCallsClosureWithObjectAsDelegate() {
-        expect:
-        container.all { assert delegate == 'a' }
-        container.add("a")
-    }
-
     def canRemoveAndMaintainOrder() {
         container.add("b")
         container.add("a")
diff --git a/subprojects/docs/src/docs/userguide/extending-gradle/task_configuration_avoidance.adoc b/subprojects/docs/src/docs/userguide/extending-gradle/task_configuration_avoidance.adoc
index c689922618dd5..e9aafcd335acc 100644
--- a/subprojects/docs/src/docs/userguide/extending-gradle/task_configuration_avoidance.adoc
+++ b/subprojects/docs/src/docs/userguide/extending-gradle/task_configuration_avoidance.adoc
@@ -196,7 +196,7 @@ This will cause your build to eagerly create fewer tasks that are registered by
 
 2. **Migrate tasks configured by name.**
 Similar to the previous point, this will cause your build to eagerly create fewer tasks that are registered by plugins.
-For example, logic that uses `TaskContainer#getByName(String, Closure)` should be converted to `TaskContainer#named(String, Action)`.
+For example, logic that uses `TaskContainer#getByName(String, Action)` should be converted to `TaskContainer#named(String, Action)`.
 This also includes <<#task_configuration_avoidance_pitfalls_hidden_eager_task_realization, task configuration via DSL blocks>>.
 
 3. **Migrate tasks creation to `register(...)`.**
@@ -375,7 +375,6 @@ It is highly recommended to have cross-version test coverage using < : NamedDomainObjectCo
     override fun matching(spec: Spec): NamedDomainObjectSet =
         delegate.matching(spec)
 
-    override fun matching(spec: Closure): NamedDomainObjectSet =
-        delegate.matching(spec)
-
     override fun clear() =
         delegate.clear()
 
     override fun addRule(rule: Rule): Rule =
         delegate.addRule(rule)
 
-    override fun addRule(description: String, ruleAction: Closure): Rule =
-        delegate.addRule(description, ruleAction)
-
     override fun addRule(description: String, ruleAction: Action): Rule =
         delegate.addRule(description, ruleAction)
 
@@ -91,9 +85,6 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo
     override fun all(action: Action) =
         delegate.all(action)
 
-    override fun all(action: Closure) =
-        delegate.all(action)
-
     override fun register(name: String, configurationAction: Action): NamedDomainObjectProvider =
         delegate.register(name, configurationAction)
 
@@ -124,10 +115,7 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo
     override fun whenObjectRemoved(action: Action): Action =
         delegate.whenObjectRemoved(action)
 
-    override fun whenObjectRemoved(action: Closure) =
-        delegate.whenObjectRemoved(action)
-
-    override fun findAll(spec: Closure): MutableSet =
+    override fun findAll(spec: Spec): MutableSet =
         delegate.findAll(spec)
 
     override fun addLater(provider: Provider) =
@@ -151,15 +139,9 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo
     override fun getByName(name: String): T =
         delegate.getByName(name)
 
-    override fun getByName(name: String, configureClosure: Closure): T =
-        delegate.getByName(name, configureClosure)
-
     override fun getByName(name: String, configureAction: Action): T =
         delegate.getByName(name, configureAction)
 
-    override fun  withType(type: Class, configureClosure: Closure): DomainObjectCollection =
-        delegate.withType(type, configureClosure)
-
     override fun configureEach(action: Action) =
         delegate.configureEach(action)
 
@@ -178,9 +160,6 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo
     override fun whenObjectAdded(action: Action): Action =
         delegate.whenObjectAdded(action)
 
-    override fun whenObjectAdded(action: Closure) =
-        delegate.whenObjectAdded(action)
-
     override fun retainAll(elements: Collection): Boolean =
         delegate.retainAll(elements)
 
diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt
index e347d662d0fd9..ae4602e025b4f 100644
--- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt
+++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt
@@ -54,18 +54,12 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun matching(spec: Spec): TaskCollection =
         delegate.matching(spec)
 
-    override fun matching(closure: Closure): TaskCollection =
-        delegate.matching(closure)
-
     override fun clear() =
         delegate.clear()
 
     override fun addRule(rule: Rule): Rule =
         delegate.addRule(rule)
 
-    override fun addRule(description: String, ruleAction: Closure): Rule =
-        delegate.addRule(description, ruleAction)
-
     override fun addRule(description: String, ruleAction: Action): Rule =
         delegate.addRule(description, ruleAction)
 
@@ -102,9 +96,6 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun whenTaskAdded(action: Action): Action =
         delegate.whenTaskAdded(action)
 
-    override fun whenTaskAdded(closure: Closure) =
-        delegate.whenTaskAdded(closure)
-
     override fun removeAll(elements: Collection): Boolean =
         delegate.removeAll(elements)
 
@@ -117,9 +108,6 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun all(action: Action) =
         delegate.all(action)
 
-    override fun all(action: Closure) =
-        delegate.all(action)
-
     override fun register(name: String, configurationAction: Action): TaskProvider =
         delegate.register(name, configurationAction)
 
@@ -168,10 +156,7 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun whenObjectRemoved(action: Action): Action =
         delegate.whenObjectRemoved(action)
 
-    override fun whenObjectRemoved(action: Closure) =
-        delegate.whenObjectRemoved(action)
-
-    override fun findAll(spec: Closure): MutableSet =
+    override fun findAll(spec: Spec): MutableSet =
         delegate.findAll(spec)
 
     override fun addLater(provider: Provider) =
@@ -186,9 +171,6 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun  containerWithType(type: Class): NamedDomainObjectContainer =
         delegate.containerWithType(type)
 
-    override fun getByName(name: String, configureClosure: Closure): Task =
-        delegate.getByName(name, configureClosure)
-
     override fun getByName(name: String): Task =
         delegate.getByName(name)
 
@@ -213,18 +195,12 @@ abstract class TaskContainerDelegate : TaskContainer {
     override fun  withType(type: Class, configureAction: Action): DomainObjectCollection =
         delegate.withType(type, configureAction)
 
-    override fun  withType(type: Class, configureClosure: Closure): DomainObjectCollection =
-        delegate.withType(type, configureClosure)
-
     override fun findByName(name: String): Task? =
         delegate.findByName(name)
 
     override fun whenObjectAdded(action: Action): Action =
         delegate.whenObjectAdded(action)
 
-    override fun whenObjectAdded(action: Closure) =
-        delegate.whenObjectAdded(action)
-
     override fun retainAll(elements: Collection): Boolean =
         delegate.retainAll(elements)
 
diff --git a/subprojects/platform-base/src/main/java/org/gradle/platform/base/internal/BinaryTasksCollectionWrapper.java b/subprojects/platform-base/src/main/java/org/gradle/platform/base/internal/BinaryTasksCollectionWrapper.java
index f07cff15de8ad..a1a1e0985fbf5 100644
--- a/subprojects/platform-base/src/main/java/org/gradle/platform/base/internal/BinaryTasksCollectionWrapper.java
+++ b/subprojects/platform-base/src/main/java/org/gradle/platform/base/internal/BinaryTasksCollectionWrapper.java
@@ -16,7 +16,6 @@
 
 package org.gradle.platform.base.internal;
 
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.DomainObjectCollection;
 import org.gradle.api.DomainObjectSet;
@@ -83,15 +82,8 @@ public DomainObjectSet matching(Spec spec) {
         return delegate.matching(spec);
     }
 
-    @SuppressWarnings("rawtypes")
     @Override
-    public DomainObjectSet matching(Closure spec) {
-        return delegate.matching(spec);
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public Set findAll(Closure spec) {
+    public Set findAll(Spec spec) {
         return delegate.findAll(spec);
     }
 
@@ -100,45 +92,21 @@ public  DomainObjectCollection withType(Class type, Action
         return delegate.withType(type, configureAction);
     }
 
-    @SuppressWarnings("rawtypes")
-    @Override
-    public  DomainObjectCollection withType(Class type, Closure configureClosure) {
-        return delegate.withType(type, configureClosure);
-    }
-
     @Override
     public Action whenObjectAdded(Action action) {
         return delegate.whenObjectAdded(action);
     }
 
-    @SuppressWarnings("rawtypes")
-    @Override
-    public void whenObjectAdded(Closure action) {
-        delegate.whenObjectAdded(action);
-    }
-
     @Override
     public Action whenObjectRemoved(Action action) {
         return delegate.whenObjectRemoved(action);
     }
 
-    @SuppressWarnings("rawtypes")
-    @Override
-    public void whenObjectRemoved(Closure action) {
-        delegate.whenObjectRemoved(action);
-    }
-
     @Override
     public void all(Action action) {
         delegate.all(action);
     }
 
-    @SuppressWarnings("rawtypes")
-    @Override
-    public void all(Closure action) {
-        delegate.all(action);
-    }
-
     @Override
     public void configureEach(Action action) {
         delegate.configureEach(action);

From 3af09e871a9f9c0d4f53b6c9b442a1d8b41b9774 Mon Sep 17 00:00:00 2001
From: Sterling Greene 
Date: Sat, 24 Sep 2022 12:48:34 -0400
Subject: [PATCH 03/40] Remove create(String, Closure) from domain object
 collections

---
 ...nsiblePolymorphicDomainObjectContainer.java | 13 -------------
 .../gradle/api/NamedDomainObjectContainer.java | 10 ----------
 .../org/gradle/api/tasks/TaskCollection.java   |  1 -
 .../org/gradle/api/tasks/TaskContainer.java    | 18 +-----------------
 .../AbstractNamedDomainObjectContainer.java    | 12 +-----------
 ...stractPolymorphicDomainObjectContainer.java |  1 -
 .../api/internal/DefaultDomainObjectSet.java   |  2 --
 ...efaultPolymorphicDomainObjectContainer.java | 11 -----------
 ...DomainObjectContainerConfigureDelegate.java |  4 +++-
 ...DomainObjectContainerConfigureDelegate.java |  3 ++-
 .../TypedDomainObjectContainerWrapper.java     |  5 -----
 .../internal/tasks/DefaultTaskContainer.java   |  6 ------
 .../NamedDomainObjectContainerDelegate.kt      |  3 ---
 .../support/delegates/TaskContainerDelegate.kt |  3 ---
 14 files changed, 7 insertions(+), 85 deletions(-)

diff --git a/subprojects/core-api/src/main/java/org/gradle/api/ExtensiblePolymorphicDomainObjectContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/ExtensiblePolymorphicDomainObjectContainer.java
index 9703dd9b8b17b..d8c75c785185d 100644
--- a/subprojects/core-api/src/main/java/org/gradle/api/ExtensiblePolymorphicDomainObjectContainer.java
+++ b/subprojects/core-api/src/main/java/org/gradle/api/ExtensiblePolymorphicDomainObjectContainer.java
@@ -15,7 +15,6 @@
  */
 package org.gradle.api;
 
-import groovy.lang.Closure;
 import org.gradle.api.internal.rules.NamedDomainObjectFactoryRegistry;
 
 /**
@@ -40,18 +39,6 @@ public interface ExtensiblePolymorphicDomainObjectContainer extends Polymorph
     @Override
      void registerFactory(Class type, NamedDomainObjectFactory factory);
 
-    /**
-     * Registers a factory for creating elements of the specified type.
-     * Typically, the specified type is an interface type.
-     *
-     * @param type the type of objects created by the factory
-     * @param factory the factory to register
-     * @param  the type of objects created by the factory
-     *
-     * @throws IllegalArgumentException if the specified type is not a subtype of the container element type
-     */
-     void registerFactory(Class type, final Closure factory);
-
     /**
      * Registers a binding from the specified "public" domain object type to the specified implementation type.
      * Whenever the container is asked to create an element with the binding's public type, it will instantiate
diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java
index b0547ce342251..8cae8cbaf8cdf 100644
--- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java
+++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java
@@ -51,16 +51,6 @@ public interface NamedDomainObjectContainer extends NamedDomainObjectSet,
      */
     T maybeCreate(String name);
 
-    /**
-     * Creates a new item with the given name, adding it to this container, then configuring it with the given closure.
-     *
-     * @param name The name to assign to the created object
-     * @param configureClosure The closure to configure the created object with
-     * @return The created object. Never null.
-     * @throws InvalidUserDataException if an object with the given name already exists in this container.
-     */
-    T create(String name, Closure configureClosure) throws InvalidUserDataException;
-
     /**
      * Creates a new item with the given name, adding it to this container, then configuring it with the given action.
      *
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 0af2a4ce72e87..f74fb9241ef0c 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
@@ -15,7 +15,6 @@
  */
 package org.gradle.api.tasks;
 
-import groovy.lang.Closure;
 import org.gradle.api.Action;
 import org.gradle.api.NamedDomainObjectSet;
 import org.gradle.api.Task;
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 4bdf5c9d6d88e..03760df8971b9 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
@@ -73,7 +73,7 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb
      * {@value org.gradle.api.Task#TASK_TYPE}The class of the task to
      * create.{@link org.gradle.api.DefaultTask}
      *
-     * {@value org.gradle.api.Task#TASK_ACTION}The closure or {@link Action} to
+     * {@value org.gradle.api.Task#TASK_ACTION}The {@link Action} to
      * execute when the task executes. See {@link Task#doFirst(Action)}.null
      *
      * {@value org.gradle.api.Task#TASK_OVERWRITE}Replace an existing
@@ -123,22 +123,6 @@ public interface TaskContainer extends TaskCollection, PolymorphicDomainOb
      */
     Task create(Map options, Closure configureClosure) throws InvalidUserDataException;
 
-    /**
-     * 

Creates a {@link Task} with the given name adds it to this container. The given closure is used to configure - * the task before it is returned by this method.

- * - *

After the task is added, it is made available as a property of the project, so that you can reference the task - * by name in your build file.

- * - * @param name The name of the task to be created - * @param configureClosure The closure to use to configure the task. - * @return The newly created task object - * @throws InvalidUserDataException If a task with the given name already exists in this project. - * @see Project#getProperties() More information about how tasks are exposed by name in build scripts - */ - @Override - Task create(String name, Closure configureClosure) throws InvalidUserDataException; - /** *

Creates a {@link Task} with the given name and adds it to this container.

* diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractNamedDomainObjectContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractNamedDomainObjectContainer.java index 6d6becc528863..913ddd41001a0 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractNamedDomainObjectContainer.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractNamedDomainObjectContainer.java @@ -65,12 +65,6 @@ public T maybeCreate(String name) { return create(name); } - @Override - public T create(String name, Closure configureClosure) { - assertMutable("create(String, Closure)"); - return create(name, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public T create(String name, Action configureAction) throws InvalidUserDataException { assertMutable("create(String, Action)"); @@ -81,13 +75,9 @@ public T create(String name, Action configureAction) throws InvalidUs return object; } - protected ConfigureDelegate createConfigureDelegate(Closure configureClosure) { - return new NamedDomainObjectContainerConfigureDelegate(configureClosure, this); - } - @Override public AbstractNamedDomainObjectContainer configure(Closure configureClosure) { - ConfigureDelegate delegate = createConfigureDelegate(configureClosure); + ConfigureDelegate delegate = new NamedDomainObjectContainerConfigureDelegate(configureClosure, this); ConfigureUtil.configureSelf(configureClosure, this, delegate); return this; } diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractPolymorphicDomainObjectContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractPolymorphicDomainObjectContainer.java index 830f5a61bf2a3..15d527d0d036a 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractPolymorphicDomainObjectContainer.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractPolymorphicDomainObjectContainer.java @@ -109,7 +109,6 @@ protected DynamicObject getElementsAsDynamicObject() { return elementsDynamicObject; } - @Override protected ConfigureDelegate createConfigureDelegate(Closure configureClosure) { return new PolymorphicDomainObjectContainerConfigureDelegate<>(configureClosure, this); } diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java index 433861ff70cf8..89a762592097a 100755 --- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultDomainObjectSet.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.DomainObjectSet; import org.gradle.api.internal.collections.CollectionEventRegister; @@ -23,7 +22,6 @@ import org.gradle.api.internal.collections.ElementSource; import org.gradle.api.internal.collections.IterationOrderRetainingSetElementSource; import org.gradle.api.specs.Spec; -import org.gradle.api.specs.Specs; import org.gradle.internal.ImmutableActionSet; import java.util.LinkedHashSet; diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultPolymorphicDomainObjectContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultPolymorphicDomainObjectContainer.java index 40d694f92740e..e432eb9e98e76 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultPolymorphicDomainObjectContainer.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultPolymorphicDomainObjectContainer.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal; -import groovy.lang.Closure; import org.gradle.api.ExtensiblePolymorphicDomainObjectContainer; import org.gradle.api.InvalidUserDataException; import org.gradle.api.Named; @@ -87,16 +86,6 @@ public void registerFactory(Class type, NamedDomainObjectFactor namedEntityInstantiator.registerFactory(type, factory); } - @Override - public void registerFactory(Class type, final Closure factory) { - registerFactory(type, new NamedDomainObjectFactory() { - @Override - public U create(String name) { - return factory.call(name); - } - }); - } - @Override public void registerBinding(Class type, final Class implementationType) { registerFactory(type, new NamedDomainObjectFactory() { diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java b/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java index 064c1a1eaf5f5..f6e34f84cc085 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java @@ -19,7 +19,9 @@ import org.gradle.api.NamedDomainObjectContainer; import org.gradle.internal.metaobject.ConfigureDelegate; import org.gradle.internal.metaobject.DynamicInvokeResult; +import org.gradle.util.internal.ConfigureUtil; +@SuppressWarnings({"FieldNamingConvention", "NewMethodNamingConvention"}) public class NamedDomainObjectContainerConfigureDelegate extends ConfigureDelegate { private final NamedDomainObjectContainer _container; @@ -36,7 +38,7 @@ protected DynamicInvokeResult _configure(String name) { @Override protected DynamicInvokeResult _configure(String name, Object[] params) { if (params.length == 1 && params[0] instanceof Closure) { - return DynamicInvokeResult.found(_container.create(name, (Closure) params[0])); + return DynamicInvokeResult.found(_container.create(name, ConfigureUtil.configureUsing((Closure) params[0]))); } return DynamicInvokeResult.notFound(); } diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/PolymorphicDomainObjectContainerConfigureDelegate.java b/subprojects/core/src/main/java/org/gradle/api/internal/PolymorphicDomainObjectContainerConfigureDelegate.java index db72cac13ab15..ac271aad0f988 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/PolymorphicDomainObjectContainerConfigureDelegate.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/PolymorphicDomainObjectContainerConfigureDelegate.java @@ -22,6 +22,7 @@ import org.gradle.internal.metaobject.DynamicInvokeResult; import org.gradle.util.internal.ConfigureUtil; +@SuppressWarnings({"FieldNamingConvention", "NewMethodNamingConvention"}) public class PolymorphicDomainObjectContainerConfigureDelegate extends ConfigureDelegate { private final PolymorphicDomainObjectContainer _container; @@ -38,7 +39,7 @@ protected DynamicInvokeResult _configure(String name) { @Override protected DynamicInvokeResult _configure(String name, Object[] params) { if (params.length == 1 && params[0] instanceof Closure) { - return DynamicInvokeResult.found(_container.create(name, (Closure) params[0])); + return DynamicInvokeResult.found(_container.create(name, ConfigureUtil.configureUsing((Closure) params[0]))); } else if (params.length == 1 && params[0] instanceof Class) { return DynamicInvokeResult.found(_container.create(name, Cast.>uncheckedCast(params[0]))); } else if (params.length == 2 && params[0] instanceof Class && params[1] instanceof Closure){ diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java b/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java index 3e30802d98321..9b2a64c911c86 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/TypedDomainObjectContainerWrapper.java @@ -63,11 +63,6 @@ public U create(String name, Action configureAction) throws InvalidUs return parent.create(name, type, configureAction); } - @Override - public U create(String name, Closure configureClosure) throws InvalidUserDataException { - return parent.create(name, type, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public U maybeCreate(String name) { return parent.maybeCreate(name, type); diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java index b41d5b4d105e9..b2a7736624ed2 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java @@ -349,12 +349,6 @@ public Task replace(String name) { return replace(name, DefaultTask.class); } - @Override - public Task create(String name, Closure configureClosure) { - assertMutable("create(String, Closure)"); - return doCreate(name, DefaultTask.class, NO_ARGS, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public T create(String name, Class type, Action configuration) throws InvalidUserDataException { assertMutable("create(String, Class, Action)"); diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt index f059fb8a3d81a..8a83ba5ab866c 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt @@ -70,9 +70,6 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo override fun create(name: String): T = delegate.create(name) - override fun create(name: String, configureClosure: Closure): T = - delegate.create(name, configureClosure) - override fun create(name: String, configureAction: Action): T = delegate.create(name, configureAction) diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt index ae4602e025b4f..d4518b68e2b4d 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/TaskContainerDelegate.kt @@ -75,9 +75,6 @@ abstract class TaskContainerDelegate : TaskContainer { override fun create(options: Map, configureClosure: Closure): Task = delegate.create(options, configureClosure) - override fun create(name: String, configureClosure: Closure): Task = - delegate.create(name, configureClosure) - override fun create(name: String): Task = delegate.create(name) From 213e39d65330ae86f18d8bdfd54a54c6e85d9b37 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 15:21:34 -0400 Subject: [PATCH 04/40] Remove most of the Closure taking methods from Task --- .../gradle/api/DomainObjectCollection.java | 2 - .../src/main/java/org/gradle/api/Project.java | 4 +- .../src/main/java/org/gradle/api/Task.java | 62 +++---------------- .../org/gradle/api/tasks/TaskCollection.java | 1 + .../main/java/org/gradle/api/DefaultTask.java | 25 +------- .../org/gradle/api/internal/AbstractTask.java | 54 ++-------------- .../org/gradle/api/internal/TaskInternal.java | 2 + .../internal/tasks/DefaultTaskContainer.java | 3 +- .../api/tasks/AbstractSpockTaskTest.groovy | 13 ---- .../gradle/api/tasks/AbstractTaskTest.groovy | 14 ----- 10 files changed, 22 insertions(+), 158 deletions(-) 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 7410f26826970..9063f806d1f65 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 @@ -15,8 +15,6 @@ */ package org.gradle.api; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.provider.Provider; import org.gradle.api.specs.Spec; diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index a6d93741d2715..7c6e0ea637316 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -200,13 +200,13 @@ *
  • The build file. The project searches for a matching method declared in the build file.
  • * *
  • The extensions added to the project by the plugins. Each extension is available as a method which takes - * a closure or {@link org.gradle.api.Action} as a parameter.
  • + * an {@link org.gradle.api.Action} as a parameter. * *
  • The convention methods added to the project by the plugins. A plugin can add properties and method to * a project through the project's {@link Convention} object.
  • * *
  • The tasks of the project. A method is added for each task, using the name of the task as the method name and - * taking a single closure or {@link org.gradle.api.Action} parameter. The method calls the {@link Task#configure(groovy.lang.Closure)} method for the + * taking a single {@link org.gradle.api.Action} parameter. The method calls the {@link Task#configure(Action)} method for the * associated task with the provided closure. For example, if the project has a task called compile, then a * method is added with the following signature: void compile(Closure configureClosure).
  • * diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Task.java b/subprojects/core-api/src/main/java/org/gradle/api/Task.java index fe788c4d6efe1..e8463909502cc 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Task.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Task.java @@ -16,8 +16,6 @@ package org.gradle.api; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import groovy.lang.MissingPropertyException; import org.gradle.api.logging.Logger; import org.gradle.api.logging.LoggingManager; @@ -52,9 +50,9 @@ * {@code task} keyword in your build file:

    *
      * task myTask
    - * task myTask { configure closure }
    + * task myTask { configure action }
      * task myTask(type: SomeType)
    - * task myTask(type: SomeType) { configure closure }
    + * task myTask(type: SomeType) { configure action }
      * 
    * *

    Each task has a name, which can be used to refer to the task within its owning project, and a fully qualified @@ -68,9 +66,7 @@ * actions is executed in turn, by calling {@link Action#execute}. You can add actions to a task by calling {@link * #doFirst(Action)} or {@link #doLast(Action)}.

    * - *

    Groovy closures can also be used to provide a task action. When the action is executed, the closure is called with - * the task as parameter. You can add action closures to a task by calling {@link #doFirst(groovy.lang.Closure)} or - * {@link #doLast(groovy.lang.Closure)}.

    + *

    Groovy closures can also be used to provide a task action. The closure is converted to an {@link Action}. * *

    There are 2 special exceptions which a task action can throw to abort execution and continue without failing the * build. A task action can abort execution of the action and continue to the next action of the task by throwing a @@ -112,8 +108,8 @@ *

  • A {@code Callable}. The {@code call()} method may return any of the types listed here. Its return value is * recursively converted to tasks. A {@code null} return value is treated as an empty collection.
  • * - *
  • A Groovy {@code Closure} or Kotlin function. The closure may take a {@code Task} as parameter. - * The closure or function may return any of the types listed here. Its return value is + *
  • A Groovy {@code Closure} or Kotlin function. The callable may take a {@code Task} as parameter. + * The callable may return any of the types listed here. Its return value is * recursively converted to tasks. A {@code null} return value is treated as an empty collection.
  • * *
  • Anything else is treated as an error.
  • @@ -259,19 +255,6 @@ public String determineName(Task c) { */ Task dependsOn(Object... paths); - /** - *

    Execute the task only if the given closure returns true. The closure will be evaluated at task execution - * time, not during configuration. The closure will be passed a single parameter, this task. If the closure returns - * false, the task will be skipped.

    - * - *

    You may add multiple such predicates. The task is skipped if any of the predicates return false.

    - * - *

    Typical usage:myTask.onlyIf { isProductionEnvironment() }

    - * - * @param onlyIfClosure code to execute to determine if task should be run - */ - void onlyIf(Closure onlyIfClosure); - /** * Do not track the state of the task. * @@ -345,17 +328,6 @@ public String determineName(Task c) { @Incubating void onlyIf(String onlyIfReason, Spec onlyIfSpec); - /** - *

    Execute the task only if the given closure returns true. The closure will be evaluated at task execution - * time, not during configuration. The closure will be passed a single parameter, this task. If the closure returns - * false, the task will be skipped.

    - * - *

    The given predicate replaces all such predicates for this task.

    - * - * @param onlyIfClosure code to execute to determine if task should be run - */ - void setOnlyIf(Closure onlyIfClosure); - /** *

    Execute the task only if the given spec is satisfied. The spec will be evaluated at task execution time, not * during configuration. If the Spec is not satisfied, the task will be skipped.

    @@ -423,15 +395,6 @@ public String determineName(Task c) { */ Task doFirst(Action action); - /** - *

    Adds the given closure to the beginning of this task's action list. The closure is passed this task as a - * parameter when executed.

    - * - * @param action The action closure to execute. - * @return This task. - */ - Task doFirst(@DelegatesTo(Task.class) Closure action); - /** *

    Adds the given {@link Action} to the beginning of this task's action list.

    * @@ -462,15 +425,6 @@ public String determineName(Task c) { */ Task doLast(String actionName, Action action); - /** - *

    Adds the given closure to the end of this task's action list. The closure is passed this task as a parameter - * when executed.

    - * - * @param action The action closure to execute. - * @return This task. - */ - Task doLast(@DelegatesTo(Task.class) Closure action); - /** *

    Returns if this task is enabled or not.

    * @@ -488,13 +442,13 @@ public String determineName(Task c) { void setEnabled(boolean enabled); /** - *

    Applies the statements of the closure against this task object. The delegate object for the closure is set to + *

    Applies the statements of the action against this task object. The delegate object for the action is set to * this task.

    * - * @param configureClosure The closure to be applied (can be null). + * @param action The action to be applied (can be null). * @return This task */ - Task configure(Closure configureClosure); + Task configure(@Nullable Action action); /** *

    Returns the AntBuilder for this task. You can use this in your build file to execute ant 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 f74fb9241ef0c..d3abb0f04419d 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 @@ -38,6 +38,7 @@ public interface TaskCollection extends NamedDomainObjectSet /** * {@inheritDoc} */ + @Override T getByName(String name, Action action) throws UnknownTaskException; /** diff --git a/subprojects/core/src/main/java/org/gradle/api/DefaultTask.java b/subprojects/core/src/main/java/org/gradle/api/DefaultTask.java index 0b0236c8f16ee..7d908e9453efa 100644 --- a/subprojects/core/src/main/java/org/gradle/api/DefaultTask.java +++ b/subprojects/core/src/main/java/org/gradle/api/DefaultTask.java @@ -16,7 +16,6 @@ package org.gradle.api; -import groovy.lang.Closure; import groovy.lang.MissingPropertyException; import org.gradle.api.internal.TaskInputsInternal; import org.gradle.api.internal.TaskOutputsInternal; @@ -279,16 +278,6 @@ public TaskDependencyInternal getTaskDependencies() { return super.getTaskDependencies(); } - @Override - public void onlyIf(Closure onlyIfClosure) { - super.onlyIf(onlyIfClosure); - } - - @Override - public void setOnlyIf(Closure onlyIfClosure) { - super.setOnlyIf(onlyIfClosure); - } - @Override public org.gradle.api.logging.LoggingManager getLogging() { return super.getLogging(); @@ -305,18 +294,8 @@ public TaskOutputsInternal getOutputs() { } @Override - public Task doFirst(Closure action) { - return super.doFirst(action); - } - - @Override - public Task doLast(Closure action) { - return super.doLast(action); - } - - @Override - public Task configure(Closure closure) { - return super.configure(closure); + public Task configure(Action action) { + return super.configure(action); } @Override diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractTask.java b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractTask.java index 4796dbdc63234..2f0bccc4d35dc 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/AbstractTask.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/AbstractTask.java @@ -62,6 +62,7 @@ import org.gradle.api.tasks.TaskInstantiationException; import org.gradle.api.tasks.TaskLocalState; import org.gradle.configuration.internal.UserCodeApplicationContext; +import org.gradle.internal.Actions; import org.gradle.internal.Cast; import org.gradle.internal.Factory; import org.gradle.internal.event.ListenerManager; @@ -318,16 +319,6 @@ public void run() { }); } - @Override - public void onlyIf(final Closure onlyIfClosure) { - taskMutator.mutate("Task.onlyIf(Closure)", new Runnable() { - @Override - public void run() { - onlyIfSpec = onlyIfSpec.and(onlyIfClosure, "Task satisfies onlyIf closure"); - } - }); - } - @Override public void onlyIf(final Spec spec) { taskMutator.mutate("Task.onlyIf(Spec)", new Runnable() { @@ -368,16 +359,6 @@ public void run() { }); } - @Override - public void setOnlyIf(final Closure onlyIfClosure) { - taskMutator.mutate("Task.setOnlyIf(Closure)", new Runnable() { - @Override - public void run() { - onlyIfSpec = createNewOnlyIfSpec().and(onlyIfClosure, "Task satisfies onlyIf closure"); - } - }); - } - private DescribingAndSpec createNewOnlyIfSpec() { return new DescribingAndSpec<>(new Spec() { @Override @@ -653,38 +634,13 @@ protected ServiceRegistry getServices() { } @Override - public Task doFirst(final Closure action) { - hasCustomActions = true; - if (action == null) { - throw new InvalidUserDataException("Action must not be null!"); - } - taskMutator.mutate("Task.doFirst(Closure)", new Runnable() { - @Override - public void run() { - getTaskActions().add(0, convertClosureToAction(action, "doFirst {} action")); - } - }); - return this; - } - - @Override - public Task doLast(final Closure action) { - hasCustomActions = true; - if (action == null) { - throw new InvalidUserDataException("Action must not be null!"); - } - taskMutator.mutate("Task.doLast(Closure)", new Runnable() { - @Override - public void run() { - getTaskActions().add(convertClosureToAction(action, "doLast {} action")); - } - }); - return this; + public Task configure(Action action) { + return Actions.with(this, action); } @Override - public Task configure(Closure closure) { - return ConfigureUtil.configureSelf(closure, this); + public Task configure(Closure cl) { + return ConfigureUtil.configureSelf(cl, this); } @Internal diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/TaskInternal.java b/subprojects/core/src/main/java/org/gradle/api/internal/TaskInternal.java index d1038a10826f2..7237f7715cd16 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/TaskInternal.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/TaskInternal.java @@ -53,6 +53,8 @@ public interface TaskInternal extends Task, Configurable { @Internal DescribingAndSpec getOnlyIf(); + Task configure(Action action); + /** * Return the reason for not to track state. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java index b2a7736624ed2..8e7a843fee30b 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskContainer.java @@ -58,6 +58,7 @@ import org.gradle.model.internal.core.MutableModelNode; import org.gradle.model.internal.core.NamedEntityInstantiator; import org.gradle.model.internal.type.ModelType; +import org.gradle.util.internal.ClosureBackedAction; import org.gradle.util.internal.ConfigureUtil; import org.gradle.util.internal.GUtil; @@ -166,7 +167,7 @@ public Task call(BuildOperationContext context) { task.doFirst(taskAction); } else if (action != null) { Closure closure = (Closure) action; - task.doFirst(closure); + task.doFirst(ClosureBackedAction.of(closure)); } addTask(task, replace); diff --git a/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractSpockTaskTest.groovy b/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractSpockTaskTest.groovy index 6919abaac1294..0a229101d2ce7 100644 --- a/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractSpockTaskTest.groovy +++ b/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractSpockTaskTest.groovy @@ -149,19 +149,6 @@ abstract class AbstractSpockTaskTest extends AbstractProjectBuilderSpec { testDescription == getTask().getDescription() } - def canSpecifyOnlyIfPredicateUsingClosure() { - DefaultTask task = getTask() - - expect: - task.getOnlyIf().isSatisfiedBy(task) - - when: - task.onlyIf(TestUtil.toClosure("{ task -> false }")) - - then: - assertFalse(task.getOnlyIf().isSatisfiedBy(task)) - } - def canSpecifyOnlyIfPredicateUsingSpec() { final Spec spec = Mock() final DefaultTask task = getTask() diff --git a/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractTaskTest.groovy b/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractTaskTest.groovy index 289334b3df041..31310d3e55df3 100644 --- a/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractTaskTest.groovy +++ b/subprojects/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractTaskTest.groovy @@ -154,20 +154,6 @@ abstract class AbstractTaskTest extends AbstractProjectBuilderSpec { testDescription == getTask().getDescription() } - def "can specify onlyIf predicate using closure"() { - given: - def task = getTask() - - expect: - task.getOnlyIf().isSatisfiedBy(task) - - when: - task.onlyIf({ false }) - - then: - !task.getOnlyIf().isSatisfiedBy(task) - } - def "can specify onlyIf predicate using spec"() { given: final task = getTask() From 9774ff128de92553f84e5d2689bc01997cd16dba Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 15:40:18 -0400 Subject: [PATCH 05/40] Add Action taking equivalents for all Closure-taking methods in Script --- ...ProblemReportingCrossProjectModelAccess.kt | 6 + .../src/main/java/org/gradle/api/Project.java | 11 ++ .../src/main/java/org/gradle/api/Script.java | 121 ++++++++++++++++++ .../api/internal/project/DefaultProject.java | 12 +- .../api/internal/project/ProjectScript.java | 12 +- .../gradle/groovy/scripts/DefaultScript.java | 37 +++++- .../org/gradle/initialization/InitScript.java | 24 +++- .../dsl/support/delegates/ProjectDelegate.kt | 4 + .../FirstPassPrecompiledScript.java | 5 +- 9 files changed, 216 insertions(+), 16 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index 60d96a770248d..ada48d21f21ec 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -42,6 +42,7 @@ import org.gradle.api.file.DeleteSpec import org.gradle.api.file.FileTree import org.gradle.api.file.ProjectLayout import org.gradle.api.file.SyncSpec +import org.gradle.api.initialization.dsl.ScriptHandler import org.gradle.api.internal.DynamicObjectAware import org.gradle.api.internal.GradleInternal import org.gradle.api.internal.ProcessOperations @@ -692,6 +693,11 @@ class ProblemReportingCrossProjectModelAccess( delegate.buildscript(configureClosure) } + override fun buildscript(action: Action) { + onAccess() + delegate.buildscript(action) + } + override fun copy(closure: Closure<*>): WorkResult { onAccess() return delegate.copy(closure) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 7c6e0ea637316..89c65d79f333c 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -1581,6 +1581,17 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void buildscript(Closure configureClosure); + /** + *

    Configures the build script classpath for this project. + * + * @param action the action to use to configure the build script classpath. + * + * @see Script#buildscript(Action) + * + * @since 8.0 + */ + void buildscript(Action action); + /** * Copies the specified files. The given closure is used to configure a {@link CopySpec}, which is then used to * copy the files. Example: diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Script.java b/subprojects/core-api/src/main/java/org/gradle/api/Script.java index aaa49d6bba477..f01ae19e04a23 100755 --- a/subprojects/core-api/src/main/java/org/gradle/api/Script.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Script.java @@ -21,9 +21,11 @@ import org.gradle.api.file.ConfigurableFileTree; import org.gradle.api.file.CopySpec; import org.gradle.api.file.FileTree; +import org.gradle.api.file.SyncSpec; import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.api.logging.Logger; import org.gradle.api.logging.LoggingManager; +import org.gradle.api.plugins.ObjectConfigurationAction; import org.gradle.api.provider.Provider; import org.gradle.api.resources.ResourceHandler; import org.gradle.api.tasks.WorkResult; @@ -57,6 +59,17 @@ public interface Script { */ void apply(Closure closure); + /** + *

    Configures the delegate object for this script using plugins or scripts. + * + *

    The given action is used to configure an {@link org.gradle.api.plugins.ObjectConfigurationAction} which is + * then used to configure the delegate object.

    + * + * @param action The action to configure the {@code ObjectConfigurationAction}. + * @since 8.0 + */ + void apply(Action action); + /** *

    Configures the delegate object for this script using plugins or scripts. * @@ -93,6 +106,16 @@ public interface Script { */ void buildscript(Closure configureClosure); + /** + * Configures the classpath for this script. + * + *

    The given action is executed against this script's {@link ScriptHandler}.

    + * + * @param action the action to use to configure the script classpath. + * @since 8.0 + */ + void buildscript(Action action); + /** *

    Resolves a file path relative to the directory containing this script. This works as described for {@link * Project#file(Object)}

    @@ -143,6 +166,20 @@ public interface Script { */ ConfigurableFileCollection files(Object paths, Closure configureClosure); + /** + *

    Creates a new {@code ConfigurableFileCollection} using the given paths. The file collection is configured + * using the given action. This method works as described for {@link Project#files(Object, Action)}. + * Relative paths are resolved relative to the directory containing this script.

    + * + * @param paths The contents of the file collection. Evaluated as per {@link #files(Object...)}. + * @param action The action to use to configure the file collection. + * @return the configured file tree. Never returns null. + * + * @see Project#files(Object, Action) + * @since 8.0 + */ + ConfigurableFileCollection files(Object paths, Action action); + /** *

    Returns the relative path from the directory containing this script to the given path. The given path object * is (logically) resolved as described for {@link #file(Object)}, from which a relative path is calculated.

    @@ -201,6 +238,31 @@ public interface Script { */ ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure); + /** + *

    Creates a new {@code ConfigurableFileTree} using the given base directory. The given baseDir path is evaluated + * as per {@link #file(Object)}. The action will be used to configure the new file tree. + * Example:

    + * + *
    +     * fileTree('src') {
    +     *    exclude '**/.svn/**'
    +     * }.copy { into 'dest'}
    +     * 
    + * + *

    The returned file tree is lazy, so that it scans for files only when the contents of the file tree are + * queried. The file tree is also live, so that it scans for files each time the contents of the file tree are + * queried.

    + * + * @param baseDir The base directory of the file tree. Evaluated as per {@link #file(Object)}. + * @param action Action to configure the {@code ConfigurableFileTree} object. + * @return the configured file tree. Never returns null. + * + * @see Project#fileTree(Object, Action) + * + * @since 8.0 + */ + ConfigurableFileTree fileTree(Object baseDir, Action action); + /** *

    Creates a new {@code FileTree} which contains the contents of the given ZIP file. The given zipPath path is * evaluated as per {@link #file(Object)}. You can combine this method with the {@link #copy(groovy.lang.Closure)} @@ -281,6 +343,52 @@ public interface Script { */ WorkResult copy(Closure closure); + /** + * Copy the specified files. The given action is used to configure a {@link org.gradle.api.file.CopySpec}, which + * is then used to copy the files. Example: + *

    +     * copy {
    +     *    from configurations.runtimeClasspath
    +     *    into 'build/deploy/lib'
    +     * }
    +     * 
    + * Note that CopySpecs can be nested: + *
    +     * copy {
    +     *    into 'build/webroot'
    +     *    exclude '**/.svn/**'
    +     *    from('src/main/webapp') {
    +     *       include '**/*.jsp'
    +     *       filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])
    +     *    }
    +     *    from('src/main/js') {
    +     *       include '**/*.js'
    +     *    }
    +     * }
    +     * 
    + * + * @param action Action to configure the CopySpec + * @return {@link org.gradle.api.tasks.WorkResult} that can be used to check if the copy did any work. + * + * @see Project#copy(Action) + * + * @since 8.0 + */ + WorkResult copy(Action action); + + /** + * Synchronizes the contents of a destination directory with some source directories and files. + * The given action is used to configure a {@link SyncSpec}, which is then used to synchronize the files. + * + * @param action Action to configure the SyncSpec + * @return {@link org.gradle.api.tasks.WorkResult} that can be used to check if the sync did any work. + * + * @see Project#sync(Action) + * + * @since 8.0 + */ + WorkResult sync(Action action); + /** * Creates a {@link org.gradle.api.file.CopySpec} which can later be used to copy files or create an archive. The * given closure is used to configure the {@link org.gradle.api.file.CopySpec} before it is returned by this @@ -291,6 +399,19 @@ public interface Script { */ CopySpec copySpec(Closure closure); + /** + * Creates a {@link org.gradle.api.file.CopySpec} which can later be used to copy files or create an archive. The + * given action is used to configure the {@link org.gradle.api.file.CopySpec} before it is returned by this + * method. + * + * @param action Action to configure the CopySpec + * @return The CopySpec + * + * @since 8.0 + * @see Project#copySpec(Action) + */ + CopySpec copySpec(Action action); + /** * Creates a directory and returns a file pointing to it. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index 9e9eb6a9c76c7..cc775e83bc3a2 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -47,6 +47,7 @@ import org.gradle.api.file.FileTree; import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.SyncSpec; +import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.api.internal.CollectionCallbackActionDecorator; import org.gradle.api.internal.DomainObjectContext; import org.gradle.api.internal.DynamicObjectAware; @@ -1259,7 +1260,12 @@ public void artifacts(Action configureAction) { @Override public void buildscript(Closure configureClosure) { - ConfigureUtil.configure(configureClosure, getBuildscript()); + buildscript(ConfigureUtil.configureUsing(configureClosure)); + } + + @Override + public void buildscript(Action action) { + Actions.with(getBuildscript(), action); } @Override @@ -1278,7 +1284,7 @@ public Task task(String task, Action configureAction) { @Override public Task task(String task, Closure configureClosure) { - return taskContainer.create(task).configure(configureClosure); + return taskContainer.create(task).configure(ConfigureUtil.configureUsing(configureClosure)); } public Task task(Object task, Closure configureClosure) { @@ -1296,7 +1302,7 @@ public Task task(Map options, Object task) { @Override public Task task(Map options, String task, Closure configureClosure) { - return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(configureClosure); + return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); } public Task task(Map options, Object task, Closure configureClosure) { diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/ProjectScript.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/ProjectScript.java index ac1f6b2924a02..779d01aaf240a 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/ProjectScript.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/ProjectScript.java @@ -15,20 +15,20 @@ */ package org.gradle.api.internal.project; -import groovy.lang.Closure; +import org.gradle.api.Action; import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.api.logging.Logger; import org.gradle.api.logging.LoggingManager; +import org.gradle.api.plugins.ObjectConfigurationAction; import org.gradle.internal.logging.StandardOutputCapture; import org.gradle.plugin.use.internal.PluginsAwareScript; import java.util.Map; public abstract class ProjectScript extends PluginsAwareScript { - @Override - public void apply(Closure closure) { - getScriptTarget().apply(closure); + public void apply(Action action) { + getScriptTarget().apply(action); } @Override @@ -43,8 +43,8 @@ public ScriptHandler getBuildscript() { } @Override - public void buildscript(Closure configureClosure) { - getScriptTarget().buildscript(configureClosure); + public void buildscript(Action action) { + getScriptTarget().buildscript(action); } @Override diff --git a/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java b/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java index 08295cf126a93..9e29bf38e1d7e 100755 --- a/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java +++ b/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java @@ -25,6 +25,7 @@ import org.gradle.api.file.CopySpec; import org.gradle.api.file.DeleteSpec; import org.gradle.api.file.FileTree; +import org.gradle.api.file.SyncSpec; import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.api.internal.ProcessOperations; import org.gradle.api.internal.file.DefaultFileOperations; @@ -40,6 +41,7 @@ import org.gradle.api.logging.Logger; import org.gradle.api.logging.Logging; import org.gradle.api.logging.LoggingManager; +import org.gradle.api.plugins.ObjectConfigurationAction; import org.gradle.api.provider.Provider; import org.gradle.api.provider.ProviderFactory; import org.gradle.api.resources.ResourceHandler; @@ -121,9 +123,14 @@ private DefaultObjectConfigurationAction createObjectConfigurationAction() { @Override public void apply(Closure closure) { - DefaultObjectConfigurationAction action = createObjectConfigurationAction(); - ConfigureUtil.configure(closure, action); - action.execute(); + apply(ConfigureUtil.configureUsing(closure)); + } + + @Override + public void apply(Action action) { + DefaultObjectConfigurationAction configurationAction = createObjectConfigurationAction(); + action.execute(configurationAction); + configurationAction.execute(); } @Override @@ -143,6 +150,11 @@ public void buildscript(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getBuildscript()); } + @Override + public void buildscript(Action action) { + Actions.with(getBuildscript(), action); + } + @Override public File file(Object path) { return fileOperations.file(path); @@ -168,6 +180,11 @@ public ConfigurableFileCollection files(Object paths, Closure configureClosure) return ConfigureUtil.configure(configureClosure, files(paths)); } + @Override + public ConfigurableFileCollection files(Object paths, Action action) { + return Actions.with(files(paths), action); + } + @Override public String relativePath(Object path) { return fileOperations.relativePath(path); @@ -188,6 +205,11 @@ public ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure) { return ConfigureUtil.configure(configureClosure, fileOperations.fileTree(baseDir)); } + @Override + public ConfigurableFileTree fileTree(Object baseDir, Action action) { + return Actions.with(fileTree(baseDir), action); + } + @Override public FileTree zipTree(Object zipPath) { return fileOperations.zipTree(zipPath); @@ -208,11 +230,13 @@ public WorkResult copy(Closure closure) { return copy(ConfigureUtil.configureUsing(closure)); } + @Override public WorkResult copy(Action action) { return fileOperations.copy(action); } - public WorkResult sync(Action action) { + @Override + public WorkResult sync(Action action) { return fileOperations.sync(action); } @@ -221,6 +245,11 @@ public CopySpec copySpec(Closure closure) { return Actions.with(copySpec(), ConfigureUtil.configureUsing(closure)); } + @Override + public CopySpec copySpec(Action action) { + return Actions.with(fileOperations.copySpec(), action); + } + public CopySpec copySpec() { return fileOperations.copySpec(); } diff --git a/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java b/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java index 74fc00087727c..54987eb3e8314 100644 --- a/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java +++ b/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java @@ -16,16 +16,38 @@ package org.gradle.initialization; import groovy.lang.Closure; +import org.gradle.api.Action; import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.groovy.scripts.DefaultScript; +import org.gradle.util.internal.ConfigureUtil; public abstract class InitScript extends DefaultScript { public ScriptHandler getInitscript() { return getBuildscript(); } + /** + * Configures the classpath for this init script. + * + * @param configureClosure closure to configure the classpath + * + * @see #buildscript(Closure) + */ public void initscript(Closure configureClosure) { - buildscript(configureClosure); + initscript(ConfigureUtil.configureUsing(configureClosure)); + } + + /** + * Configures the classpath for this init script. + * + * @param action closure to configure the classpath + * + * @see #buildscript(Action) + * + * @since 8.0 + */ + public void initscript(Action action) { + buildscript(action); } public String toString() { diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index da5cca764ec8f..cfee625788b12 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -142,6 +142,10 @@ abstract class ProjectDelegate : Project { override fun buildscript(configureClosure: Closure<*>) = delegate.buildscript(configureClosure) + override fun buildscript(action: Action) { + delegate.buildscript(action) + } + override fun getProject(): Project = delegate.project diff --git a/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/internal/precompiled/FirstPassPrecompiledScript.java b/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/internal/precompiled/FirstPassPrecompiledScript.java index 4c566e54714b3..a5b1f22c71daf 100644 --- a/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/internal/precompiled/FirstPassPrecompiledScript.java +++ b/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/internal/precompiled/FirstPassPrecompiledScript.java @@ -16,14 +16,15 @@ package org.gradle.plugin.devel.internal.precompiled; -import groovy.lang.Closure; +import org.gradle.api.Action; +import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.plugin.use.internal.PluginsAwareScript; public abstract class FirstPassPrecompiledScript extends PluginsAwareScript { @SuppressWarnings("rawtypes") @Override - public void buildscript(Closure configureClosure) { + public void buildscript(Action action) { throw new IllegalStateException("The `buildscript` block is not supported in Groovy script plugins. Use the `plugins` block or project level dependencies instead."); } } From 76f0977bddba16b234bfe6a3ee959c5cfb58845c Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 16:09:51 -0400 Subject: [PATCH 06/40] Remove Closure taking methods from Script --- .../src/main/java/org/gradle/api/Script.java | 112 +----------------- .../gradle/groovy/scripts/DefaultScript.java | 41 ------- .../org/gradle/initialization/InitScript.java | 13 -- .../use/internal/PluginsAwareScript.java | 5 + 4 files changed, 7 insertions(+), 164 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Script.java b/subprojects/core-api/src/main/java/org/gradle/api/Script.java index f01ae19e04a23..cefd9a41503f4 100755 --- a/subprojects/core-api/src/main/java/org/gradle/api/Script.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Script.java @@ -15,8 +15,6 @@ */ package org.gradle.api; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.ConfigurableFileTree; import org.gradle.api.file.CopySpec; @@ -49,15 +47,6 @@ * on this {@code Script} object is forwarded to the delegate object.

    */ public interface Script { - /** - *

    Configures the delegate object for this script using plugins or scripts. - * - *

    The given closure is used to configure an {@link org.gradle.api.plugins.ObjectConfigurationAction} which is - * then used to configure the delegate object.

    - * - * @param closure The closure to configure the {@code ObjectConfigurationAction}. - */ - void apply(Closure closure); /** *

    Configures the delegate object for this script using plugins or scripts. @@ -96,16 +85,6 @@ public interface Script { */ ScriptHandler getBuildscript(); - /** - * Configures the classpath for this script. - * - *

    The given closure is executed against this script's {@link ScriptHandler}. The {@link ScriptHandler} is passed - * to the closure as the closure's delegate. - * - * @param configureClosure the closure to use to configure the script classpath. - */ - void buildscript(Closure configureClosure); - /** * Configures the classpath for this script. * @@ -155,17 +134,6 @@ public interface Script { */ ConfigurableFileCollection files(Object... paths); - /** - *

    Creates a new {@code ConfigurableFileCollection} using the given paths. The file collection is configured - * using the given closure. This method works as described for {@link Project#files(Object, groovy.lang.Closure)}. - * Relative paths are resolved relative to the directory containing this script.

    - * - * @param paths The contents of the file collection. Evaluated as per {@link #files(Object...)}. - * @param configureClosure The closure to use to configure the file collection. - * @return the configured file tree. Never returns null. - */ - ConfigurableFileCollection files(Object paths, Closure configureClosure); - /** *

    Creates a new {@code ConfigurableFileCollection} using the given paths. The file collection is configured * using the given action. This method works as described for {@link Project#files(Object, Action)}. @@ -217,27 +185,6 @@ public interface Script { */ ConfigurableFileTree fileTree(Map args); - /** - *

    Creates a new {@code ConfigurableFileTree} using the given base directory. The given baseDir path is evaluated - * as per {@link #file(Object)}. The closure will be used to configure the new file tree. - * The file tree is passed to the closure as its delegate. Example:

    - * - *
    -     * fileTree('src') {
    -     *    exclude '**/.svn/**'
    -     * }.copy { into 'dest'}
    -     * 
    - * - *

    The returned file tree is lazy, so that it scans for files only when the contents of the file tree are - * queried. The file tree is also live, so that it scans for files each time the contents of the file tree are - * queried.

    - * - * @param baseDir The base directory of the file tree. Evaluated as per {@link #file(Object)}. - * @param configureClosure Closure to configure the {@code ConfigurableFileTree} object. - * @return the configured file tree. Never returns null. - */ - ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure); - /** *

    Creates a new {@code ConfigurableFileTree} using the given base directory. The given baseDir path is evaluated * as per {@link #file(Object)}. The action will be used to configure the new file tree. @@ -265,7 +212,7 @@ public interface Script { /** *

    Creates a new {@code FileTree} which contains the contents of the given ZIP file. The given zipPath path is - * evaluated as per {@link #file(Object)}. You can combine this method with the {@link #copy(groovy.lang.Closure)} + * evaluated as per {@link #file(Object)}. You can combine this method with the {@link #copy(Action)} * method to unzip a ZIP file.

    * *

    The returned file tree is lazy, so that it scans for files only when the contents of the file tree are @@ -290,7 +237,7 @@ public interface Script { *

    * Unless custom implementation of resources is passed, the tar tree attempts to guess the compression based on the file extension. *

    - * You can combine this method with the {@link #copy(groovy.lang.Closure)} + * You can combine this method with the {@link #copy(Action)} * method to untar a TAR file: * *

    @@ -314,35 +261,6 @@ public interface Script {
          */
         FileTree tarTree(Object tarPath);
     
    -    /**
    -     * Copy the specified files.  The given closure is used to configure a {@link org.gradle.api.file.CopySpec}, which
    -     * is then used to copy the files. Example:
    -     * 
    -     * copy {
    -     *    from configurations.runtimeClasspath
    -     *    into 'build/deploy/lib'
    -     * }
    -     * 
    - * Note that CopySpecs can be nested: - *
    -     * copy {
    -     *    into 'build/webroot'
    -     *    exclude '**/.svn/**'
    -     *    from('src/main/webapp') {
    -     *       include '**/*.jsp'
    -     *       filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])
    -     *    }
    -     *    from('src/main/js') {
    -     *       include '**/*.js'
    -     *    }
    -     * }
    -     * 
    - * - * @param closure Closure to configure the CopySpec - * @return {@link org.gradle.api.tasks.WorkResult} that can be used to check if the copy did any work. - */ - WorkResult copy(Closure closure); - /** * Copy the specified files. The given action is used to configure a {@link org.gradle.api.file.CopySpec}, which * is then used to copy the files. Example: @@ -389,16 +307,6 @@ public interface Script { */ WorkResult sync(Action action); - /** - * Creates a {@link org.gradle.api.file.CopySpec} which can later be used to copy files or create an archive. The - * given closure is used to configure the {@link org.gradle.api.file.CopySpec} before it is returned by this - * method. - * - * @param closure Closure to configure the CopySpec - * @return The CopySpec - */ - CopySpec copySpec(Closure closure); - /** * Creates a {@link org.gradle.api.file.CopySpec} which can later be used to copy files or create an archive. The * given action is used to configure the {@link org.gradle.api.file.CopySpec} before it is returned by this @@ -429,14 +337,6 @@ public interface Script { */ boolean delete(Object... paths); - /** - * Executes a Java main class. The closure configures a {@link org.gradle.process.JavaExecSpec}. - * - * @param closure The closure for configuring the execution. - * @return the result of the execution - */ - ExecResult javaexec(@DelegatesTo(JavaExecSpec.class) Closure closure); - /** * Executes a Java main class. * @@ -445,14 +345,6 @@ public interface Script { */ ExecResult javaexec(Action action); - /** - * Executes an external command. The closure configures a {@link org.gradle.process.ExecSpec}. - * - * @param closure The closure for configuring the execution. - * @return the result of the execution - */ - ExecResult exec(@DelegatesTo(ExecSpec.class) Closure closure); - /** * Executes an external command. * diff --git a/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java b/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java index 9e29bf38e1d7e..385832545d388 100755 --- a/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java +++ b/subprojects/core/src/main/java/org/gradle/groovy/scripts/DefaultScript.java @@ -16,7 +16,6 @@ package org.gradle.groovy.scripts; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.PathValidation; import org.gradle.api.Script; @@ -121,11 +120,6 @@ private DefaultObjectConfigurationAction createObjectConfigurationAction() { ); } - @Override - public void apply(Closure closure) { - apply(ConfigureUtil.configureUsing(closure)); - } - @Override public void apply(Action action) { DefaultObjectConfigurationAction configurationAction = createObjectConfigurationAction(); @@ -145,11 +139,6 @@ public ScriptHandler getBuildscript() { return scriptServices.get(ScriptHandler.class); } - @Override - public void buildscript(Closure configureClosure) { - ConfigureUtil.configure(configureClosure, getBuildscript()); - } - @Override public void buildscript(Action action) { Actions.with(getBuildscript(), action); @@ -175,11 +164,6 @@ public ConfigurableFileCollection files(Object... paths) { return fileOperations.configurableFiles(paths); } - @Override - public ConfigurableFileCollection files(Object paths, Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, files(paths)); - } - @Override public ConfigurableFileCollection files(Object paths, Action action) { return Actions.with(files(paths), action); @@ -200,11 +184,6 @@ public ConfigurableFileTree fileTree(Map args) { return fileOperations.fileTree(args); } - @Override - public ConfigurableFileTree fileTree(Object baseDir, Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, fileOperations.fileTree(baseDir)); - } - @Override public ConfigurableFileTree fileTree(Object baseDir, Action action) { return Actions.with(fileTree(baseDir), action); @@ -225,11 +204,6 @@ public ResourceHandler getResources() { return fileOperations.getResources(); } - @Override - public WorkResult copy(Closure closure) { - return copy(ConfigureUtil.configureUsing(closure)); - } - @Override public WorkResult copy(Action action) { return fileOperations.copy(action); @@ -240,11 +214,6 @@ public WorkResult sync(Action action) { return fileOperations.sync(action); } - @Override - public CopySpec copySpec(Closure closure) { - return Actions.with(copySpec(), ConfigureUtil.configureUsing(closure)); - } - @Override public CopySpec copySpec(Action action) { return Actions.with(fileOperations.copySpec(), action); @@ -268,21 +237,11 @@ public WorkResult delete(Action action) { return fileOperations.delete(action); } - @Override - public ExecResult javaexec(Closure closure) { - return processOperations.javaexec(ConfigureUtil.configureUsing(closure)); - } - @Override public ExecResult javaexec(Action action) { return processOperations.javaexec(action); } - @Override - public ExecResult exec(Closure closure) { - return processOperations.exec(ConfigureUtil.configureUsing(closure)); - } - @Override public ExecResult exec(Action action) { return processOperations.exec(action); diff --git a/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java b/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java index 54987eb3e8314..c3a07ce901627 100644 --- a/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java +++ b/subprojects/core/src/main/java/org/gradle/initialization/InitScript.java @@ -15,28 +15,15 @@ */ package org.gradle.initialization; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.initialization.dsl.ScriptHandler; import org.gradle.groovy.scripts.DefaultScript; -import org.gradle.util.internal.ConfigureUtil; public abstract class InitScript extends DefaultScript { public ScriptHandler getInitscript() { return getBuildscript(); } - /** - * Configures the classpath for this init script. - * - * @param configureClosure closure to configure the classpath - * - * @see #buildscript(Closure) - */ - public void initscript(Closure configureClosure) { - initscript(ConfigureUtil.configureUsing(configureClosure)); - } - /** * Configures the classpath for this init script. * diff --git a/subprojects/core/src/main/java/org/gradle/plugin/use/internal/PluginsAwareScript.java b/subprojects/core/src/main/java/org/gradle/plugin/use/internal/PluginsAwareScript.java index 653d4ef2419e5..90ada73b325a2 100644 --- a/subprojects/core/src/main/java/org/gradle/plugin/use/internal/PluginsAwareScript.java +++ b/subprojects/core/src/main/java/org/gradle/plugin/use/internal/PluginsAwareScript.java @@ -18,6 +18,8 @@ import groovy.lang.Closure; import org.gradle.groovy.scripts.DefaultScript; +import org.gradle.groovy.scripts.internal.InitialPassStatementTransformer; +import org.gradle.groovy.scripts.internal.ScriptBlock; import org.gradle.plugin.management.internal.PluginRequests; import org.gradle.plugin.use.PluginDependenciesSpec; import org.gradle.util.internal.ConfigureUtil; @@ -26,6 +28,9 @@ abstract public class PluginsAwareScript extends DefaultScript { private PluginRequestCollector pluginRequestCollector; + /** + * Used by {@link InitialPassStatementTransformer#addLineNumberToMethodCall(ScriptBlock)} + */ public void plugins(int lineNumber, Closure configureClosure) { if (pluginRequestCollector == null) { pluginRequestCollector = new PluginRequestCollector(getScriptSource()); From 9bae576801dbd5e02beb3b8121242a385fbe065d Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 16:31:08 -0400 Subject: [PATCH 07/40] Linkify types in Task javadoc --- .../core-api/src/main/java/org/gradle/api/Task.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Task.java b/subprojects/core-api/src/main/java/org/gradle/api/Task.java index e8463909502cc..e03766cee52d8 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Task.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Task.java @@ -37,8 +37,11 @@ import javax.annotation.Nullable; import java.io.File; import java.time.Duration; +import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.concurrent.Callable; /** *

    A Task represents a single atomic piece of work for a build, such as compiling classes or generating @@ -87,7 +90,7 @@ * *

      * - *
    • A {@code String}, {@code CharSequence} or {@code groovy.lang.GString} task path or name. A relative path is interpreted relative to the task's {@link Project}. This + *
    • A {@link String}, {@link CharSequence} or {@link groovy.lang.GString} task path or name. A relative path is interpreted relative to the task's {@link Project}. This * allows you to refer to tasks in other projects. These task references will not cause task creation.
    • * *
    • A {@link Task}.
    • @@ -102,13 +105,13 @@ * *
    • A {@link Provider} object. May contain any of the types listed here.
    • * - *
    • A {@code Iterable}, {@code Collection}, {@code Map} or array. May contain any of the types listed here. The elements of the + *
    • A {@link Iterable}, {@link Collection}, {@link Map} or array. May contain any of the types listed here. The elements of the * iterable/collection/map/array are recursively converted to tasks.
    • * - *
    • A {@code Callable}. The {@code call()} method may return any of the types listed here. Its return value is + *
    • A {@link Callable}. The {@code call()} method may return any of the types listed here. Its return value is * recursively converted to tasks. A {@code null} return value is treated as an empty collection.
    • * - *
    • A Groovy {@code Closure} or Kotlin function. The callable may take a {@code Task} as parameter. + *
    • A Groovy {@link groovy.lang.Closure} or Kotlin function. The callable may take a {@code Task} as parameter. * The callable may return any of the types listed here. Its return value is * recursively converted to tasks. A {@code null} return value is treated as an empty collection.
    • * From 6997035f52b473c93f12c439e5d7f5c545afee28 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 16:35:04 -0400 Subject: [PATCH 08/40] Remove Closure taking methods from ComponentSelectionRules --- .../artifacts/ComponentSelectionRules.java | 23 ------------------- .../DefaultComponentSelectionRules.java | 11 --------- .../DefaultComponentSelectionRulesTest.groovy | 6 ----- 3 files changed, 40 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ComponentSelectionRules.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ComponentSelectionRules.java index 1157d45a148d6..ce2d361bcbc5e 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ComponentSelectionRules.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ComponentSelectionRules.java @@ -16,8 +16,6 @@ package org.gradle.api.artifacts; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.internal.HasInternalProtocol; @@ -66,16 +64,6 @@ public interface ComponentSelectionRules { */ ComponentSelectionRules all(Action selectionAction); - /** - * Adds a component selection rule that will apply to all resolved components. - * - * Each rule will receive a {@link ComponentSelection} object as an argument. - * - * @param closure the Closure that implements a rule to be applied - * @return this - */ - ComponentSelectionRules all(@DelegatesTo(ComponentSelection.class) Closure closure); - /** * Adds a rule-source backed component selection rule that will apply to all resolved components. * @@ -102,17 +90,6 @@ public interface ComponentSelectionRules { */ ComponentSelectionRules withModule(Object id, Action selectionAction); - /** - * Adds a component selection rule that will apply to the specified module. - * - * Each rule will receive a {@link ComponentSelection} object as an argument. - * - * @param id the module to apply this rule to in "group:module" format or as a {@link org.gradle.api.artifacts.ModuleIdentifier} - * @param closure the Closure that implements a rule to be applied - * @return this - */ - ComponentSelectionRules withModule(Object id, @DelegatesTo(ComponentSelection.class) Closure closure); - /** * Adds a rule-source backed component selection rule that will apply to the specified module. * diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRules.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRules.java index e458d8add4d6d..615aff8a98bfe 100644 --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRules.java +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRules.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.artifacts.ivyservice.resolutionstrategy; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.InvalidUserCodeException; import org.gradle.api.artifacts.ComponentSelection; @@ -88,11 +87,6 @@ public ComponentSelectionRules all(Action selectionA return addRule(createAllSpecRulesAction(ruleActionAdapter.createFromAction(selectionAction))); } - @Override - public ComponentSelectionRules all(Closure closure) { - return addRule(createAllSpecRulesAction(ruleActionAdapter.createFromClosure(ComponentSelection.class, closure))); - } - @Override public ComponentSelectionRules all(Object ruleSource) { return addRule(createAllSpecRulesAction(ruleActionAdapter.createFromRuleSource(ComponentSelection.class, ruleSource))); @@ -103,11 +97,6 @@ public ComponentSelectionRules withModule(Object id, Action closure) { - return addRule(createSpecRuleActionFromId(id, ruleActionAdapter.createFromClosure(ComponentSelection.class, closure))); - } - @Override public ComponentSelectionRules withModule(Object id, Object ruleSource) { return addRule(createSpecRuleActionFromId(id, ruleActionAdapter.createFromRuleSource(ComponentSelection.class, ruleSource))); diff --git a/subprojects/dependency-management/src/test/groovy/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRulesTest.groovy b/subprojects/dependency-management/src/test/groovy/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRulesTest.groovy index 007abcea25536..bc55ffbe47bc6 100644 --- a/subprojects/dependency-management/src/test/groovy/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRulesTest.groovy +++ b/subprojects/dependency-management/src/test/groovy/org/gradle/api/internal/artifacts/ivyservice/resolutionstrategy/DefaultComponentSelectionRulesTest.groovy @@ -259,18 +259,12 @@ class DefaultComponentSelectionRulesTest extends Specification { when: rules.all(Actions.doNothing()) then: 1 * checker.validateMutation(STRATEGY) - when: rules.all(Closure.IDENTITY) - then: 1 * checker.validateMutation(STRATEGY) - when: rules.all(ruleSource) then: 1 * checker.validateMutation(STRATEGY) when: rules.withModule("something:else", Actions.doNothing()) then: 1 * checker.validateMutation(STRATEGY) - when: rules.withModule("something:else", Closure.IDENTITY) - then: 1 * checker.validateMutation(STRATEGY) - when: rules.withModule("something:else", ruleSource) then: 1 * checker.validateMutation(STRATEGY) } From ec11839d3b7e4df184a524ce0f4afb56ec2cbbda Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 16:37:40 -0400 Subject: [PATCH 09/40] Remove Closure from ModuleDependency --- .../gradle/api/artifacts/ModuleDependency.java | 18 ------------------ .../api/artifacts/dsl/DependencyHandler.java | 2 +- .../dependencies/AbstractModuleDependency.java | 8 -------- .../catalog/DelegatingProjectDependency.java | 7 ------- .../support/delegates/ClientModuleDelegate.kt | 5 ----- 5 files changed, 1 insertion(+), 39 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ModuleDependency.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ModuleDependency.java index 965ca04577c5c..d05407ef87215 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ModuleDependency.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ModuleDependency.java @@ -15,8 +15,6 @@ */ package org.gradle.api.artifacts; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.attributes.AttributeContainer; import org.gradle.api.attributes.HasConfigurableAttributes; @@ -27,8 +25,6 @@ import java.util.Map; import java.util.Set; -import static groovy.lang.Closure.DELEGATE_FIRST; - /** * A {@code ModuleDependency} is a {@link org.gradle.api.artifacts.Dependency} on a module outside the current project. * @@ -97,20 +93,6 @@ public interface ModuleDependency extends Dependency, HasConfigurableAttributes< */ ModuleDependency addArtifact(DependencyArtifact artifact); - /** - *

      Adds an artifact to this dependency. The given closure is passed a {@link - * org.gradle.api.artifacts.DependencyArtifact} instance, which it can configure.

      - * - *

      If no artifact is added to a dependency, an implicit default artifact is used. This default artifact has the - * same name as the module and its type and extension is {@code jar}. If at least one artifact is explicitly added, - * the implicit default artifact won't be used any longer.

      - * - * @return the added artifact - * - * @see DependencyArtifact - */ - DependencyArtifact artifact(@DelegatesTo(value = DependencyArtifact.class, strategy = DELEGATE_FIRST) Closure configureClosure); - /** *

      Adds an artifact to this dependency. The given action is passed a {@link * org.gradle.api.artifacts.DependencyArtifact} instance, which it can configure.

      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/DependencyHandler.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/DependencyHandler.java index 0ce051099eb9a..00fc9ced2041b 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/DependencyHandler.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/DependencyHandler.java @@ -113,7 +113,7 @@ * More examples of advanced configuration, useful when dependency module has multiple artifacts: *
        *
      • Declaring dependency to a specific configuration of the module.
      • - *
      • Explicit specification of the artifact. See also {@link org.gradle.api.artifacts.ModuleDependency#artifact(groovy.lang.Closure)}.
      • + *
      • Explicit specification of the artifact. See also {@link org.gradle.api.artifacts.ModuleDependency#artifact(Action)}.
      • *
      * *
      diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/artifacts/dependencies/AbstractModuleDependency.java b/subprojects/core/src/main/java/org/gradle/api/internal/artifacts/dependencies/AbstractModuleDependency.java
      index bd72dffb9326f..09f07ceebeb6a 100644
      --- a/subprojects/core/src/main/java/org/gradle/api/internal/artifacts/dependencies/AbstractModuleDependency.java
      +++ b/subprojects/core/src/main/java/org/gradle/api/internal/artifacts/dependencies/AbstractModuleDependency.java
      @@ -16,7 +16,6 @@
       package org.gradle.api.internal.artifacts.dependencies;
       
       import com.google.common.base.Objects;
      -import groovy.lang.Closure;
       import org.gradle.api.Action;
       import org.gradle.api.InvalidUserCodeException;
       import org.gradle.api.artifacts.DependencyArtifact;
      @@ -41,8 +40,6 @@
       import java.util.Map;
       import java.util.Set;
       
      -import static org.gradle.util.internal.ConfigureUtil.configureUsing;
      -
       public abstract class AbstractModuleDependency extends AbstractDependency implements ModuleDependency {
           private final static Logger LOG = Logging.getLogger(AbstractModuleDependency.class);
       
      @@ -124,11 +121,6 @@ public AbstractModuleDependency addArtifact(DependencyArtifact artifact) {
               return this;
           }
       
      -    @Override
      -    public DependencyArtifact artifact(Closure configureClosure) {
      -        return artifact(configureUsing(configureClosure));
      -    }
      -
           @Override
           public DependencyArtifact artifact(Action configureAction) {
               validateNotVariantAware();
      diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/catalog/DelegatingProjectDependency.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/catalog/DelegatingProjectDependency.java
      index 10a547d229931..4033a937b8869 100644
      --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/catalog/DelegatingProjectDependency.java
      +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/catalog/DelegatingProjectDependency.java
      @@ -15,7 +15,6 @@
        */
       package org.gradle.api.internal.catalog;
       
      -import groovy.lang.Closure;
       import org.gradle.api.Action;
       import org.gradle.api.Project;
       import org.gradle.api.artifacts.Configuration;
      @@ -88,12 +87,6 @@ public ModuleDependency addArtifact(DependencyArtifact artifact) {
               return delegate.addArtifact(artifact);
           }
       
      -    @Override
      -    @SuppressWarnings("rawtypes")
      -    public DependencyArtifact artifact(Closure configureClosure) {
      -        return delegate.artifact(configureClosure);
      -    }
      -
           @Override
           public DependencyArtifact artifact(Action configureAction) {
               return delegate.artifact(configureAction);
      diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ClientModuleDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ClientModuleDelegate.kt
      index 598d020ecee85..620e8dec5c80c 100644
      --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ClientModuleDelegate.kt
      +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ClientModuleDelegate.kt
      @@ -16,8 +16,6 @@
       
       package org.gradle.kotlin.dsl.support.delegates
       
      -import groovy.lang.Closure
      -
       import org.gradle.api.Action
       import org.gradle.api.artifacts.ClientModule
       import org.gradle.api.artifacts.Dependency
      @@ -62,9 +60,6 @@ abstract class ClientModuleDelegate : ClientModule {
           override fun addArtifact(artifact: DependencyArtifact): ModuleDependency =
               delegate.addArtifact(artifact)
       
      -    override fun artifact(configureClosure: Closure): DependencyArtifact =
      -        delegate.artifact(configureClosure)
      -
           override fun artifact(configureAction: Action): DependencyArtifact =
               delegate.artifact(configureAction)
       
      
      From 0479d4ed2c769934c811b922c7f4d2ff8c427f80 Mon Sep 17 00:00:00 2001
      From: Sterling Greene 
      Date: Sat, 24 Sep 2022 16:43:05 -0400
      Subject: [PATCH 10/40] Remove Closure taking methods from Configuration
      
      ---
       .../gradle/api/artifacts/Configuration.java   | 48 -----------------
       .../api/artifacts/ResolvableDependencies.java | 16 ------
       .../artifacts/result/ResolutionResult.java    | 18 -------
       .../configurations/DefaultConfiguration.java  | 51 -------------------
       .../ErrorHandlingConfigurationResolver.java   | 13 -----
       .../result/DefaultResolutionResult.java       | 12 -----
       6 files changed, 158 deletions(-)
      
      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/Configuration.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/Configuration.java
      index 98bf66debb2a5..e0bee11a82547 100644
      --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/Configuration.java
      +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/Configuration.java
      @@ -15,8 +15,6 @@
        */
       package org.gradle.api.artifacts;
       
      -import groovy.lang.Closure;
      -import groovy.lang.DelegatesTo;
       import org.gradle.api.Action;
       import org.gradle.api.Incubating;
       import org.gradle.api.attributes.HasConfigurableAttributes;
      @@ -30,8 +28,6 @@
       import java.util.Map;
       import java.util.Set;
       
      -import static groovy.lang.Closure.DELEGATE_FIRST;
      -
       /**
        * A {@code Configuration} represents a group of artifacts and their dependencies.
        * Find more information about declaring dependencies to a configuration
      @@ -58,16 +54,6 @@ public interface Configuration extends FileCollection, HasConfigurableAttributes
            */
           ResolutionStrategy getResolutionStrategy();
       
      -    /**
      -     * The resolution strategy provides extra details on how to resolve this configuration.
      -     * See docs for {@link ResolutionStrategy} for more info and examples.
      -     *
      -     * @param closure closure applied to the {@link ResolutionStrategy}
      -     * @return this configuration instance
      -     * @since 1.0-milestone-6
      -     */
      -    Configuration resolutionStrategy(@DelegatesTo(value = ResolutionStrategy.class, strategy = DELEGATE_FIRST) Closure closure);
      -
           /**
            * The resolution strategy provides extra details on how to resolve this configuration.
            * See docs for {@link ResolutionStrategy} for more info and examples.
      @@ -199,15 +185,6 @@ public String determineName(Configuration c) {
            */
           Set resolve();
       
      -    /**
      -     * Takes a closure which gets coerced into a {@link Spec}. Behaves otherwise in the same way as
      -     * {@link #files(org.gradle.api.specs.Spec)}.
      -     *
      -     * @param dependencySpecClosure The closure describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).
      -     * @return The files of a subset of dependencies of this configuration.
      -     */
      -    Set files(Closure dependencySpecClosure);
      -
           /**
            * Resolves this configuration. This locates and downloads the files which make up this configuration.
            * But only the resulting set of files belonging to the subset of dependencies specified by the dependencySpec
      @@ -238,15 +215,6 @@ public String determineName(Configuration c) {
            */
           FileCollection fileCollection(Spec dependencySpec);
       
      -    /**
      -     * Takes a closure which gets coerced into a {@link Spec}. Behaves otherwise in the same way as
      -     * {@link #fileCollection(org.gradle.api.specs.Spec)}.
      -     *
      -     * @param dependencySpecClosure The closure describing a filter applied to the all the dependencies of this configuration (including dependencies from extended configurations).
      -     * @return The FileCollection with a subset of dependencies of this configuration.
      -     */
      -    FileCollection fileCollection(Closure dependencySpecClosure);
      -
           /**
            * Resolves this configuration lazily. The resolve happens when the elements of the returned {@link FileCollection} get accessed the first time.
            * This locates and downloads the files which make up this configuration. Only the resulting set of files belonging to specified
      @@ -497,22 +465,6 @@ public String determineName(Configuration c) {
            */
           Configuration copyRecursive(Spec dependencySpec);
       
      -    /**
      -     * Takes a closure which gets coerced into a {@link Spec}. Behaves otherwise in the same way as {@link #copy(org.gradle.api.specs.Spec)}
      -     *
      -     * @param dependencySpec filtering requirements
      -     * @return copy of this configuration
      -     */
      -    Configuration copy(Closure dependencySpec);
      -
      -    /**
      -     * Takes a closure which gets coerced into a {@link Spec}. Behaves otherwise in the same way as {@link #copyRecursive(org.gradle.api.specs.Spec)}
      -     *
      -     * @param dependencySpec filtering requirements
      -     * @return copy of this configuration
      -     */
      -    Configuration copyRecursive(Closure dependencySpec);
      -
           /**
            * Configures if a configuration can be consumed.
            *
      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ResolvableDependencies.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ResolvableDependencies.java
      index 70b550fab9253..0d9d1616e0d3e 100644
      --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ResolvableDependencies.java
      +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/ResolvableDependencies.java
      @@ -15,8 +15,6 @@
        */
       package org.gradle.api.artifacts;
       
      -import groovy.lang.Closure;
      -import groovy.lang.DelegatesTo;
       import org.gradle.api.Action;
       import org.gradle.api.artifacts.result.ResolutionResult;
       import org.gradle.api.file.FileCollection;
      @@ -82,13 +80,6 @@ public interface ResolvableDependencies extends ArtifactView {
            */
           void beforeResolve(Action action);
       
      -    /**
      -     * Adds an action to be executed before the dependencies in this set are resolved.
      -     *
      -     * @param action The action to execute.
      -     */
      -    void beforeResolve(@DelegatesTo(ResolvableDependencies.class) Closure action);
      -
           /**
            * Adds an action to be executed after the dependencies of this set have been resolved.
            *
      @@ -96,13 +87,6 @@ public interface ResolvableDependencies extends ArtifactView {
            */
           void afterResolve(Action action);
       
      -    /**
      -     * Adds an action to be executed after the dependencies of this set have been resolved.
      -     *
      -     * @param action The action to execute.
      -     */
      -    void afterResolve(@DelegatesTo(ResolvableDependencies.class) Closure action);
      -
           /**
            * Returns the resolved dependency graph, performing the resolution if required. This will resolve the dependency graph but will not resolve or download the files.
            *
      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/result/ResolutionResult.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/result/ResolutionResult.java
      index aa52ee378dae5..46f3f74880074 100644
      --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/result/ResolutionResult.java
      +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/result/ResolutionResult.java
      @@ -16,8 +16,6 @@
       
       package org.gradle.api.artifacts.result;
       
      -import groovy.lang.Closure;
      -import groovy.lang.DelegatesTo;
       import org.gradle.api.Action;
       import org.gradle.api.Incubating;
       import org.gradle.api.attributes.AttributeContainer;
      @@ -75,14 +73,6 @@ public interface ResolutionResult {
            */
           void allDependencies(Action action);
       
      -    /**
      -     * Applies given closure for each dependency.
      -     * An instance of {@link DependencyResult} is passed as parameter to the closure.
      -     *
      -     * @param closure - closure that is applied for each dependency
      -     */
      -    void allDependencies(@DelegatesTo(DependencyResult.class) Closure closure);
      -
           /**
            * Retrieves all instances of {@link ResolvedComponentResult} from the graph,
            * e.g. all nodes of the dependency graph.
      @@ -99,14 +89,6 @@ public interface ResolutionResult {
            */
           void allComponents(Action action);
       
      -    /**
      -     * Applies given closure for each component.
      -     * An instance of {@link ResolvedComponentResult} is passed as parameter to the closure.
      -     *
      -     * @param closure - closure that is applied for each component
      -     */
      -    void allComponents(@DelegatesTo(ResolvedComponentResult.class) Closure closure);
      -
           /**
            * The attributes that were requested. Those are the attributes which
            * are used during variant aware resolution, to select the variants.
      diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/configurations/DefaultConfiguration.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/configurations/DefaultConfiguration.java
      index 56c6a94352ab7..967945a2f2cd4 100644
      --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/configurations/DefaultConfiguration.java
      +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/configurations/DefaultConfiguration.java
      @@ -20,7 +20,6 @@
       import com.google.common.collect.ImmutableList;
       import com.google.common.collect.ImmutableSet;
       import com.google.common.collect.Sets;
      -import groovy.lang.Closure;
       import org.gradle.api.Action;
       import org.gradle.api.Describable;
       import org.gradle.api.DomainObjectSet;
      @@ -130,7 +129,6 @@
       import org.gradle.internal.work.WorkerThreadRegistry;
       import org.gradle.util.Path;
       import org.gradle.util.internal.CollectionUtils;
      -import org.gradle.util.internal.ConfigureUtil;
       import org.gradle.util.internal.WrapUtil;
       
       import javax.annotation.Nullable;
      @@ -153,7 +151,6 @@
       import static org.gradle.api.internal.artifacts.configurations.ConfigurationInternal.InternalState.BUILD_DEPENDENCIES_RESOLVED;
       import static org.gradle.api.internal.artifacts.configurations.ConfigurationInternal.InternalState.GRAPH_RESOLVED;
       import static org.gradle.api.internal.artifacts.configurations.ConfigurationInternal.InternalState.UNRESOLVED;
      -import static org.gradle.util.internal.ConfigureUtil.configure;
       
       @SuppressWarnings("rawtypes")
       public class DefaultConfiguration extends AbstractFileCollection implements ConfigurationInternal, MutationValidator {
      @@ -530,11 +527,6 @@ public Set files(Dependency... dependencies) {
               return fileCollection(dependencies).getFiles();
           }
       
      -    @Override
      -    public Set files(Closure dependencySpecClosure) {
      -        return fileCollection(dependencySpecClosure).getFiles();
      -    }
      -
           @Override
           public Set files(Spec dependencySpec) {
               return fileCollection(dependencySpec).getFiles();
      @@ -550,11 +542,6 @@ private ConfigurationFileCollection fileCollectionFromSpec(Spec deps = WrapUtil.toLinkedSet(dependencies);
      @@ -1257,16 +1244,6 @@ private String getNameWithCopySuffix() {
                   : copyName + count;
           }
       
      -    @Override
      -    public Configuration copy(Closure dependencySpec) {
      -        return copy(Specs.convertClosureToSpec(dependencySpec));
      -    }
      -
      -    @Override
      -    public Configuration copyRecursive(Closure dependencySpec) {
      -        return copyRecursive(Specs.convertClosureToSpec(dependencySpec));
      -    }
      -
           @Override
           public ResolutionStrategyInternal getResolutionStrategy() {
               if (resolutionStrategy == null) {
      @@ -1305,12 +1282,6 @@ public boolean getReturnAllVariants() {
               return this.returnAllVariants;
           }
       
      -    @Override
      -    public Configuration resolutionStrategy(Closure closure) {
      -        configure(closure, getResolutionStrategy());
      -        return this;
      -    }
      -
           @Override
           public Configuration resolutionStrategy(Action action) {
               action.execute(getResolutionStrategy());
      @@ -1808,21 +1779,11 @@ public void beforeResolve(Action action) {
                   dependencyResolutionListeners.add("beforeResolve", userCodeApplicationContext.reapplyCurrentLater(action));
               }
       
      -        @Override
      -        public void beforeResolve(Closure action) {
      -            beforeResolve(ConfigureUtil.configureUsing(action));
      -        }
      -
               @Override
               public void afterResolve(Action action) {
                   dependencyResolutionListeners.add("afterResolve", userCodeApplicationContext.reapplyCurrentLater(action));
               }
       
      -        @Override
      -        public void afterResolve(Closure action) {
      -            afterResolve(ConfigureUtil.configureUsing(action));
      -        }
      -
               @Override
               public ResolutionResult getResolutionResult() {
                   assertIsResolvable();
      @@ -1942,12 +1903,6 @@ public void allDependencies(Action action) {
                       delegate.allDependencies(action);
                   }
       
      -            @Override
      -            public void allDependencies(Closure closure) {
      -                resolve();
      -                delegate.allDependencies(closure);
      -            }
      -
                   @Override
                   public Set getAllComponents() {
                       resolve();
      @@ -1960,12 +1915,6 @@ public void allComponents(Action action) {
                       delegate.allComponents(action);
                   }
       
      -            @Override
      -            public void allComponents(Closure closure) {
      -                resolve();
      -                delegate.allComponents(closure);
      -            }
      -
                   @Override
                   public AttributeContainer getRequestedAttributes() {
                       return delegate.getRequestedAttributes();
      diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ErrorHandlingConfigurationResolver.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ErrorHandlingConfigurationResolver.java
      index c721045dd1ffa..b896b540aa0a4 100644
      --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ErrorHandlingConfigurationResolver.java
      +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ErrorHandlingConfigurationResolver.java
      @@ -15,7 +15,6 @@
        */
       package org.gradle.api.internal.artifacts.ivyservice;
       
      -import groovy.lang.Closure;
       import org.gradle.api.Action;
       import org.gradle.api.artifacts.Dependency;
       import org.gradle.api.artifacts.LenientConfiguration;
      @@ -234,12 +233,6 @@ public Set getAllDependencies() {
                   }
               }
       
      -        @Override
      -        @SuppressWarnings("rawtypes")
      -        public void allDependencies(Closure closure) {
      -            resolutionResult.allDependencies(closure);
      -        }
      -
               @Override
               public Set getAllComponents() {
                   try {
      @@ -254,12 +247,6 @@ public void allComponents(Action action) {
                   resolutionResult.allComponents(action);
               }
       
      -        @Override
      -        @SuppressWarnings("rawtypes")
      -        public void allComponents(Closure closure) {
      -            resolutionResult.allComponents(closure);
      -        }
      -
               @Override
               public AttributeContainer getRequestedAttributes() {
                   return resolutionResult.getRequestedAttributes();
      diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/result/DefaultResolutionResult.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/result/DefaultResolutionResult.java
      index 2b1ddd908324b..71e18d517f7ba 100644
      --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/result/DefaultResolutionResult.java
      +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/result/DefaultResolutionResult.java
      @@ -16,7 +16,6 @@
       
       package org.gradle.api.internal.artifacts.result;
       
      -import groovy.lang.Closure;
       import org.gradle.api.Action;
       import org.gradle.api.artifacts.result.DependencyResult;
       import org.gradle.api.artifacts.result.ResolutionResult;
      @@ -27,7 +26,6 @@
       import org.gradle.api.provider.Provider;
       import org.gradle.internal.Actions;
       import org.gradle.internal.Factory;
      -import org.gradle.util.internal.ConfigureUtil;
       
       import java.util.HashSet;
       import java.util.LinkedHashSet;
      @@ -67,11 +65,6 @@ public void allDependencies(Action action) {
               eachElement(getRoot(), Actions.doNothing(), action, new HashSet<>());
           }
       
      -    @Override
      -    public void allDependencies(final Closure closure) {
      -        allDependencies(ConfigureUtil.configureUsing(closure));
      -    }
      -
           private void eachElement(
               ResolvedComponentResult node,
               Action moduleAction, Action dependencyAction,
      @@ -101,11 +94,6 @@ public void allComponents(final Action action)
               eachElement(getRoot(), action, Actions.doNothing(), new HashSet<>());
           }
       
      -    @Override
      -    public void allComponents(final Closure closure) {
      -        allComponents(ConfigureUtil.configureUsing(closure));
      -    }
      -
           @Override
           public AttributeContainer getRequestedAttributes() {
               return requestedAttributes;
      
      From ff87683cf8ae823acd43ea8478a3635182f92a1b Mon Sep 17 00:00:00 2001
      From: Sterling Greene 
      Date: Sat, 24 Sep 2022 16:45:45 -0400
      Subject: [PATCH 11/40] Remove Closure-taking methods from ArtifactHandler
      
      ---
       .../gradle/api/artifacts/dsl/ArtifactHandler.java  | 12 ------------
       .../artifacts/dsl/DefaultArtifactHandler.java      | 14 +-------------
       .../support/delegates/ArtifactHandlerDelegate.kt   |  5 -----
       3 files changed, 1 insertion(+), 30 deletions(-)
      
      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ArtifactHandler.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ArtifactHandler.java
      index 90fbba552dadb..660db587efcc5 100644
      --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ArtifactHandler.java
      +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ArtifactHandler.java
      @@ -15,8 +15,6 @@
        */
       package org.gradle.api.artifacts.dsl;
       
      -import groovy.lang.Closure;
      -import groovy.lang.DelegatesTo;
       import org.gradle.api.Action;
       import org.gradle.api.artifacts.ConfigurablePublishArtifact;
       import org.gradle.api.artifacts.PublishArtifact;
      @@ -85,16 +83,6 @@ public interface ArtifactHandler {
            */
           PublishArtifact add(String configurationName, Object artifactNotation);
       
      -    /**
      -     * Adds an artifact to the given configuration.
      -     *
      -     * @param configurationName The name of the configuration.
      -     * @param artifactNotation The artifact notation, in one of the notations described above.
      -     * @param configureClosure The closure to execute to configure the artifact.
      -     * @return The artifact.
      -     */
      -    PublishArtifact add(String configurationName, Object artifactNotation, @DelegatesTo(ConfigurablePublishArtifact.class) Closure configureClosure);
      -
           /**
            * Adds an artifact to the given configuration.
            *
      diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultArtifactHandler.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultArtifactHandler.java
      index de3edd4cfe452..8727ccdf73024 100644
      --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultArtifactHandler.java
      +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultArtifactHandler.java
      @@ -48,12 +48,6 @@ public DefaultArtifactHandler(ConfigurationContainer configurationContainer, Not
               dynamicMethods = new DynamicMethods();
           }
       
      -    @SuppressWarnings("rawtypes")
      -    private PublishArtifact pushArtifact(org.gradle.api.artifacts.Configuration configuration, Object notation, Closure configureClosure) {
      -        Action configureAction = ConfigureUtil.configureUsing(configureClosure);
      -        return pushArtifact(configuration, notation, configureAction);
      -    }
      -
           private PublishArtifact pushArtifact(Configuration configuration, Object notation, Action configureAction) {
               warnIfConfigurationIsDeprecated((DeprecatableConfiguration) configuration);
               ConfigurablePublishArtifact publishArtifact = publishArtifactFactory.parseNotation(notation);
      @@ -82,12 +76,6 @@ public PublishArtifact add(String configurationName, Object artifactNotation) {
               return pushArtifact(configurationContainer.getByName(configurationName), artifactNotation, Actions.doNothing());
           }
       
      -    @Override
      -    @SuppressWarnings("rawtypes")
      -    public PublishArtifact add(String configurationName, Object artifactNotation, Closure configureClosure) {
      -        return pushArtifact(configurationContainer.getByName(configurationName), artifactNotation, configureClosure);
      -    }
      -
           @Override
           public MethodAccess getAdditionalMethods() {
               return dynamicMethods;
      @@ -110,7 +98,7 @@ public DynamicInvokeResult tryInvokeMethod(String name, Object... arguments) {
                   }
                   List normalizedArgs = GUtil.flatten(Arrays.asList(arguments), false);
                   if (normalizedArgs.size() == 2 && normalizedArgs.get(1) instanceof Closure) {
      -                return DynamicInvokeResult.found(pushArtifact(configuration, normalizedArgs.get(0), (Closure) normalizedArgs.get(1)));
      +                return DynamicInvokeResult.found(pushArtifact(configuration, normalizedArgs.get(0), ConfigureUtil.configureUsing((Closure) normalizedArgs.get(1))));
                   } else {
                       for (Object notation : normalizedArgs) {
                           pushArtifact(configuration, notation, Actions.doNothing());
      diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ArtifactHandlerDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ArtifactHandlerDelegate.kt
      index d1de924fc126f..a527a02faf7c5 100644
      --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ArtifactHandlerDelegate.kt
      +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ArtifactHandlerDelegate.kt
      @@ -16,8 +16,6 @@
       
       package org.gradle.kotlin.dsl.support.delegates
       
      -import groovy.lang.Closure
      -
       import org.gradle.api.Action
       import org.gradle.api.artifacts.ConfigurablePublishArtifact
       import org.gradle.api.artifacts.PublishArtifact
      @@ -37,9 +35,6 @@ abstract class ArtifactHandlerDelegate : ArtifactHandler {
           override fun add(configurationName: String, artifactNotation: Any): PublishArtifact =
               delegate.add(configurationName, artifactNotation)
       
      -    override fun add(configurationName: String, artifactNotation: Any, configureClosure: Closure): PublishArtifact =
      -        delegate.add(configurationName, artifactNotation, configureClosure)
      -
           override fun add(configurationName: String, artifactNotation: Any, configureAction: Action): PublishArtifact =
               delegate.add(configurationName, artifactNotation, configureAction)
       }
      
      From 8dabaa9206e8d5c715c46a56dabf9ed74ebc4e55 Mon Sep 17 00:00:00 2001
      From: Sterling Greene 
      Date: Sat, 24 Sep 2022 17:33:14 -0400
      Subject: [PATCH 12/40] Remove Closure from ComponentMetadataHandler
      
      ---
       .../dsl/ComponentMetadataHandler.java         | 35 -------------------
       .../dsl/DefaultComponentMetadataHandler.java  | 11 ------
       ...DefaultDependencyResolutionManagement.java | 15 +-------
       3 files changed, 1 insertion(+), 60 deletions(-)
      
      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ComponentMetadataHandler.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ComponentMetadataHandler.java
      index 692026deed6a9..26c6a9db33bb5 100644
      --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ComponentMetadataHandler.java
      +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/ComponentMetadataHandler.java
      @@ -15,8 +15,6 @@
        */
       package org.gradle.api.artifacts.dsl;
       
      -import groovy.lang.Closure;
      -import groovy.lang.DelegatesTo;
       import org.gradle.api.Action;
       import org.gradle.api.ActionConfiguration;
       import org.gradle.api.artifacts.ComponentMetadataDetails;
      @@ -70,28 +68,6 @@ public interface ComponentMetadataHandler {
            */
           ComponentMetadataHandler all(Action rule);
       
      -    /**
      -     * Adds a rule closure that may modify the metadata of any resolved software component.
      -     *
      -     * 

      The supplied rule closure must declare a {@link ComponentMetadataDetails} as it's first parameter, - * allowing the component metadata to be modified. - * - *

      In addition, the rule can declare additional (read-only) parameters, which may provide extra details - * about the component. The order of these additional parameters is not significant. - * - *

      The following additional parameter types are supported: - *

        - *
      • {@link org.gradle.api.artifacts.ivy.IvyModuleDescriptor} - additional Ivy-specific - * metadata. Rules declaring this parameter will only be invoked for components packaged as an Ivy module.
      • - *
      • {@link org.gradle.api.artifacts.maven.PomModuleDescriptor} - additional Maven-specific - * metadata. Rules declaring this parameter will only be invoked for components packaged as a POM module.
      • - *
      - * - * @param rule the rule to be added - * @return this - */ - ComponentMetadataHandler all(@DelegatesTo(ComponentMetadataDetails.class) Closure rule); - /** * Adds a rule that may modify the metadata of any resolved software component. * @@ -140,17 +116,6 @@ public interface ComponentMetadataHandler { */ ComponentMetadataHandler withModule(Object id, Action rule); - /** - * Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. - * - *

      The rule closure parameter is subject to the same requirements as {@link #all(groovy.lang.Closure)}. - * - * @param id the module to apply this rule to in "group:module" format or as a {@link org.gradle.api.artifacts.ModuleIdentifier} - * @param rule the rule to be added - * @return this - */ - ComponentMetadataHandler withModule(Object id, @DelegatesTo(ComponentMetadataDetails.class) Closure rule); - /** * Adds a rule that may modify the metadata of any resolved software component belonging to the specified module. * diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultComponentMetadataHandler.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultComponentMetadataHandler.java index d939d1fb164db..6d6a75982722c 100644 --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultComponentMetadataHandler.java +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultComponentMetadataHandler.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.artifacts.dsl; import com.google.common.collect.Interner; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.ActionConfiguration; import org.gradle.api.InvalidUserCodeException; @@ -167,11 +166,6 @@ public ComponentMetadataHandler all(Action rul return addRule(createAllSpecRuleAction(ruleActionAdapter.createFromAction(rule))); } - @Override - public ComponentMetadataHandler all(Closure rule) { - return addRule(createAllSpecRuleAction(ruleActionAdapter.createFromClosure(ComponentMetadataDetails.class, rule))); - } - @Override public ComponentMetadataHandler all(Object ruleSource) { return addRule(createAllSpecRuleAction(ruleActionAdapter.createFromRuleSource(ComponentMetadataDetails.class, ruleSource))); @@ -182,11 +176,6 @@ public ComponentMetadataHandler withModule(Object id, Action rule) { - return addRule(createSpecRuleActionForModule(id, ruleActionAdapter.createFromClosure(ComponentMetadataDetails.class, rule))); - } - @Override public ComponentMetadataHandler withModule(Object id, Object ruleSource) { return addRule(createSpecRuleActionForModule(id, ruleActionAdapter.createFromRuleSource(ComponentMetadataDetails.class, ruleSource))); diff --git a/subprojects/dependency-management/src/main/java/org/gradle/internal/management/DefaultDependencyResolutionManagement.java b/subprojects/dependency-management/src/main/java/org/gradle/internal/management/DefaultDependencyResolutionManagement.java index 645f73629feb0..c1722891b0891 100644 --- a/subprojects/dependency-management/src/main/java/org/gradle/internal/management/DefaultDependencyResolutionManagement.java +++ b/subprojects/dependency-management/src/main/java/org/gradle/internal/management/DefaultDependencyResolutionManagement.java @@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.ActionConfiguration; import org.gradle.api.InvalidUserCodeException; @@ -30,9 +29,9 @@ import org.gradle.api.artifacts.repositories.ArtifactRepository; import org.gradle.api.initialization.dsl.VersionCatalogBuilder; import org.gradle.api.initialization.resolve.DependencyResolutionManagement; +import org.gradle.api.initialization.resolve.MutableVersionCatalogContainer; import org.gradle.api.initialization.resolve.RepositoriesMode; import org.gradle.api.initialization.resolve.RulesMode; -import org.gradle.api.initialization.resolve.MutableVersionCatalogContainer; import org.gradle.api.internal.CollectionCallbackActionDecorator; import org.gradle.api.internal.artifacts.DependencyManagementServices; import org.gradle.api.internal.artifacts.DependencyResolutionServices; @@ -237,12 +236,6 @@ public ComponentMetadataHandler all(Action rul return this; } - @Override - public ComponentMetadataHandler all(Closure rule) { - components(h -> h.all(rule)); - return this; - } - @Override public ComponentMetadataHandler all(Object ruleSource) { components(h -> h.all(ruleSource)); @@ -267,12 +260,6 @@ public ComponentMetadataHandler withModule(Object id, Action rule) { - components(h -> h.withModule(id, rule)); - return this; - } - @Override public ComponentMetadataHandler withModule(Object id, Object ruleSource) { components(h -> h.withModule(id, ruleSource)); From 4fc0614dfaad8f3f8d2308ca5170129b9f6209af Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 17:35:21 -0400 Subject: [PATCH 13/40] Remove Closure taking methods from RepositoryHandler --- .../api/artifacts/dsl/RepositoryHandler.java | 26 ------------------- .../dsl/DefaultRepositoryHandler.java | 20 -------------- 2 files changed, 46 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/RepositoryHandler.java b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/RepositoryHandler.java index 47af56d301c8b..fa8c75bc076c7 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/RepositoryHandler.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/artifacts/dsl/RepositoryHandler.java @@ -15,8 +15,6 @@ */ package org.gradle.api.artifacts.dsl; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.artifacts.ArtifactRepositoryContainer; import org.gradle.api.artifacts.repositories.ArtifactRepository; @@ -68,14 +66,6 @@ public interface RepositoryHandler extends ArtifactRepositoryContainer { */ FlatDirectoryArtifactRepository flatDir(Map args); - /** - * Adds an configures a repository which will look for dependencies in a number of local directories. - * - * @param configureClosure The closure to execute to configure the repository. - * @return The repository. - */ - FlatDirectoryArtifactRepository flatDir(@DelegatesTo(FlatDirectoryArtifactRepository.class) Closure configureClosure); - /** * Adds an configures a repository which will look for dependencies in a number of local directories. * @@ -300,14 +290,6 @@ public interface RepositoryHandler extends ArtifactRepositoryContainer { */ MavenArtifactRepository google(Action action); - /** - * Adds and configures a Maven repository. Newly created instance of {@code MavenArtifactRepository} is passed as an argument to the closure. - * - * @param closure The closure to use to configure the repository. - * @return The added repository. - */ - MavenArtifactRepository maven(@DelegatesTo(MavenArtifactRepository.class) Closure closure); - /** * Adds and configures a Maven repository. * @@ -316,14 +298,6 @@ public interface RepositoryHandler extends ArtifactRepositoryContainer { */ MavenArtifactRepository maven(Action action); - /** - * Adds and configures an Ivy repository. Newly created instance of {@code IvyArtifactRepository} is passed as an argument to the closure. - * - * @param closure The closure to use to configure the repository. - * @return The added repository. - */ - IvyArtifactRepository ivy(@DelegatesTo(IvyArtifactRepository.class) Closure closure); - /** * Adds and configures an Ivy repository. * diff --git a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultRepositoryHandler.java b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultRepositoryHandler.java index 2d7f0d8712596..70e6946dbe703 100644 --- a/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultRepositoryHandler.java +++ b/subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/dsl/DefaultRepositoryHandler.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.artifacts.dsl; import com.google.common.collect.Lists; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.InvalidUserCodeException; import org.gradle.api.artifacts.dsl.RepositoryHandler; @@ -36,7 +35,6 @@ import org.gradle.internal.Factory; import org.gradle.internal.deprecation.DeprecationLogger; import org.gradle.internal.reflect.Instantiator; -import org.gradle.util.internal.ConfigureUtil; import java.util.HashMap; import java.util.List; @@ -73,12 +71,6 @@ public FlatDirectoryArtifactRepository flatDir(Action args) { Map modifiedArgs = new HashMap<>(args); @@ -161,23 +153,11 @@ public MavenArtifactRepository maven(Action act return addRepository(repositoryFactory.createMavenRepository(), MAVEN_REPO_DEFAULT_NAME, action); } - @Override - @SuppressWarnings("rawtypes") - public MavenArtifactRepository maven(Closure closure) { - return maven(ConfigureUtil.configureUsing(closure)); - } - @Override public IvyArtifactRepository ivy(Action action) { return addRepository(repositoryFactory.createIvyRepository(), IVY_REPO_DEFAULT_NAME, action); } - @Override - @SuppressWarnings("rawtypes") - public IvyArtifactRepository ivy(Closure closure) { - return ivy(ConfigureUtil.configureUsing(closure)); - } - @Override public void exclusiveContent(Action action) { ExclusiveContentRepositorySpec spec = Cast.uncheckedCast(instantiator.newInstance(ExclusiveContentRepositorySpec.class, this)); From a9ac5555272fbdc8ea52e947582ed1a393d08c90 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 17:43:49 -0400 Subject: [PATCH 14/40] Add Configurable.configure(Action) --- .../src/main/java/org/gradle/api/Task.java | 4 ++-- .../java/org/gradle/util/Configurable.java | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Task.java b/subprojects/core-api/src/main/java/org/gradle/api/Task.java index e03766cee52d8..b6426ab1ba87b 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Task.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Task.java @@ -448,10 +448,10 @@ public String determineName(Task c) { *

      Applies the statements of the action against this task object. The delegate object for the action is set to * this task.

      * - * @param action The action to be applied (can be null). + * @param action The action to be applied. * @return This task */ - Task configure(@Nullable Action action); + Task configure(Action action); /** *

      Returns the AntBuilder for this task. You can use this in your build file to execute ant diff --git a/subprojects/core-api/src/main/java/org/gradle/util/Configurable.java b/subprojects/core-api/src/main/java/org/gradle/util/Configurable.java index 2cae79a59cfe5..3636de32047ff 100644 --- a/subprojects/core-api/src/main/java/org/gradle/util/Configurable.java +++ b/subprojects/core-api/src/main/java/org/gradle/util/Configurable.java @@ -17,12 +17,28 @@ package org.gradle.util; import groovy.lang.Closure; +import org.gradle.api.Action; +import org.gradle.internal.Cast; /** - * An object that can be configured with a Groovy closure. + * An object that can be configured. * - * @param the closure return type. + * @param the return type. */ public interface Configurable { T configure(Closure cl); + + /** + * Configures this object with the given action. + * + * @param action the action to configure with + * @return this + * + * @since 8.0 + */ + default T configure(Action action) { + T target = Cast.uncheckedCast(this); + action.execute(target); + return target; + } } From ad90633e74ae46c7b8e4640a5e77849a30341e4e Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:00:34 -0400 Subject: [PATCH 15/40] Remove most of the Closure-taking methods in Project --- ...ProblemReportingCrossProjectModelAccess.kt | 82 ------ .../src/main/java/org/gradle/api/Project.java | 235 +----------------- .../java/org/gradle/api/file/CopySpec.java | 2 +- .../api/internal/project/DefaultProject.java | 104 -------- .../dsl/support/delegates/ProjectDelegate.kt | 51 ---- 5 files changed, 3 insertions(+), 471 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index ada48d21f21ec..9b3869fafba87 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -305,11 +305,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.task(args, name, configureClosure) } - override fun task(name: String, configureClosure: Closure<*>): Task { - onAccess() - return delegate.task(name, configureClosure) - } - override fun task(name: String, configureAction: Action): Task { onAccess() return delegate.task(name, configureAction) @@ -383,11 +378,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.files(*paths) } - override fun files(paths: Any, configureClosure: Closure<*>): ConfigurableFileCollection { - onAccess() - return delegate.files(paths, configureClosure) - } - override fun files(paths: Any, configureAction: Action): ConfigurableFileCollection { onAccess() return delegate.files(paths, configureAction) @@ -398,11 +388,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.fileTree(baseDir) } - override fun fileTree(baseDir: Any, configureClosure: Closure<*>): ConfigurableFileTree { - onAccess() - return delegate.fileTree(baseDir, configureClosure) - } - override fun fileTree(baseDir: Any, configureAction: Action): ConfigurableFileTree { onAccess() return delegate.fileTree(baseDir, configureAction) @@ -458,21 +443,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.delete(action) } - override fun javaexec(closure: Closure<*>): ExecResult { - onAccess() - return delegate.javaexec(closure) - } - override fun javaexec(action: Action): ExecResult { onAccess() return delegate.javaexec(action) } - override fun exec(closure: Closure<*>): ExecResult { - onAccess() - return delegate.exec(closure) - } - override fun exec(action: Action): ExecResult { onAccess() return delegate.exec(action) @@ -496,11 +471,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.createAntBuilder() } - override fun ant(configureClosure: Closure<*>): AntBuilder { - onAccess() - return delegate.ant(configureClosure) - } - override fun ant(configureAction: Action): AntBuilder { onAccess() return delegate.ant(configureAction) @@ -521,11 +491,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.artifacts } - override fun artifacts(configureClosure: Closure<*>) { - onAccess() - delegate.artifacts(configureClosure) - } - override fun artifacts(configureAction: Action) { onAccess() delegate.artifacts(configureAction) @@ -546,10 +511,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.depth } - override fun project(path: String, configureClosure: Closure<*>): Project { - return project(path, ConfigureUtil.configureUsing(configureClosure)) - } - override fun project(path: String, configureAction: Action): Project { return delegate.project(referrer, path, configureAction) } @@ -570,10 +531,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.subprojects(referrer, action) } - override fun subprojects(configureClosure: Closure<*>) { - delegate.subprojects(referrer, ConfigureUtil.configureUsing(configureClosure)) - } - override fun subprojects(referrer: ProjectInternal, configureAction: Action) { delegate.subprojects(referrer, configureAction) } @@ -590,10 +547,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.allprojects(referrer, action) } - override fun allprojects(configureClosure: Closure<*>) { - delegate.allprojects(referrer, ConfigureUtil.configureUsing(configureClosure)) - } - override fun allprojects(referrer: ProjectInternal, configureAction: Action) { delegate.allprojects(referrer, configureAction) } @@ -608,16 +561,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.afterEvaluate(action) } - override fun beforeEvaluate(closure: Closure<*>) { - onAccess() - delegate.beforeEvaluate(closure) - } - - override fun afterEvaluate(closure: Closure<*>) { - onAccess() - delegate.afterEvaluate(closure) - } - override fun hasProperty(propertyName: String): Boolean { onAccess() return delegate.hasProperty(propertyName) @@ -648,16 +591,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.logging } - override fun configure(target: Any, configureClosure: Closure<*>): Any { - onAccess() - return delegate.configure(target, configureClosure) - } - - override fun configure(targets: MutableIterable<*>, configureClosure: Closure<*>): MutableIterable<*> { - onAccess() - return delegate.configure(targets, configureClosure) - } - override fun configure(targets: MutableIterable, configureAction: Action): MutableIterable { onAccess() return delegate.configure(targets, configureAction) @@ -688,31 +621,16 @@ class ProblemReportingCrossProjectModelAccess( return delegate.dependencyFactory } - override fun buildscript(configureClosure: Closure<*>) { - onAccess() - delegate.buildscript(configureClosure) - } - override fun buildscript(action: Action) { onAccess() delegate.buildscript(action) } - override fun copy(closure: Closure<*>): WorkResult { - onAccess() - return delegate.copy(closure) - } - override fun copy(action: Action): WorkResult { onAccess() return delegate.copy(action) } - override fun copySpec(closure: Closure<*>): CopySpec { - onAccess() - return delegate.copySpec(closure) - } - override fun copySpec(action: Action): CopySpec { onAccess() return delegate.copySpec(action) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 89c65d79f333c..19eeab5efcfef 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -17,7 +17,6 @@ package org.gradle.api; import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import groovy.lang.MissingPropertyException; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.dsl.ArtifactHandler; @@ -507,19 +506,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Task task(Map args, String name, Closure configureClosure); - /** - *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given - * closure is executed to configure the task.

      After the task is added to the project, it is made - * available as a property of the project, so that you can reference the task by name in your build file. See here for more details

      - * - * @param name The name of the task to be created - * @param configureClosure The closure to use to configure the created task. - * @return The newly created task object - * @throws InvalidUserDataException If a task with the given name already exists in this project. - */ - Task task(String name, @DelegatesTo(Task.class) Closure configureClosure); - /** *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given * action is executed to configure the task.

      After the task is added to the project, it is made @@ -599,17 +585,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Project project(String path) throws UnknownProjectException; - /** - *

      Locates a project by path and configures it using the given closure. If the path is relative, it is - * interpreted relative to this project. The target project is passed to the closure as the closure's delegate.

      - * - * @param path The path. - * @param configureClosure The closure to use to configure the project. - * @return The project with the given path. Never returns null. - * @throws UnknownProjectException If no project with the given path exists. - */ - Project project(String path, @DelegatesTo(Project.class) Closure configureClosure); - /** *

      Locates a project by path and configures it using the given action. If the path is relative, it is * interpreted relative to this project.

      @@ -765,25 +740,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ConfigurableFileCollection files(Object... paths); - /** - *

      Creates a new {@code ConfigurableFileCollection} using the given paths. The paths are evaluated as per {@link - * #files(Object...)}. The file collection is configured using the given closure. The file collection is passed to - * the closure as its delegate. Example:

      - *
      -     * files "$buildDir/classes" {
      -     *     builtBy 'compile'
      -     * }
      -     * 
      - *

      The returned file collection is lazy, so that the paths are evaluated only when the contents of the file - * collection are queried. The file collection is also live, so that it evaluates the above each time the contents - * of the collection is queried.

      - * - * @param paths The contents of the file collection. Evaluated as per {@link #files(Object...)}. - * @param configureClosure The closure to use to configure the file collection. - * @return the configured file tree. Never returns null. - */ - ConfigurableFileCollection files(Object paths, @DelegatesTo(ConfigurableFileCollection.class) Closure configureClosure); - /** *

      Creates a new {@code ConfigurableFileCollection} using the given paths. The paths are evaluated as per {@link * #files(Object...)}. The file collection is configured using the given action. Example:

      @@ -828,34 +784,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ConfigurableFileTree fileTree(Object baseDir); - /** - *

      Creates a new {@code ConfigurableFileTree} using the given base directory. The given baseDir path is evaluated - * as per {@link #file(Object)}. The closure will be used to configure the new file tree. - * The file tree is passed to the closure as its delegate. Example:

      - * - *
      -     * def myTree = fileTree('src') {
      -     *    exclude '**/.data/**'
      -     *    builtBy 'someTask'
      -     * }
      -     *
      -     * task copy(type: Copy) {
      -     *    from myTree
      -     * }
      -     * 
      - * - *

      The returned file tree is lazy, so that it scans for files only when the contents of the file tree are - * queried. The file tree is also live, so that it scans for files each time the contents of the file tree are - * queried.

      - * - *

      The order of the files in a {@code FileTree} is not stable, even on a single computer. - * - * @param baseDir The base directory of the file tree. Evaluated as per {@link #file(Object)}. - * @param configureClosure Closure to configure the {@code ConfigurableFileTree} object. - * @return the configured file tree. Never returns null. - */ - ConfigurableFileTree fileTree(Object baseDir, @DelegatesTo(ConfigurableFileTree.class) Closure configureClosure); - /** *

      Creates a new {@code ConfigurableFileTree} using the given base directory. The given baseDir path is evaluated * as per {@link #file(Object)}. The action will be used to configure the new file tree. Example:

      @@ -1025,14 +953,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ WorkResult delete(Action action); - /** - * Executes a Java main class. The closure configures a {@link org.gradle.process.JavaExecSpec}. - * - * @param closure The closure for configuring the execution. - * @return the result of the execution - */ - ExecResult javaexec(@DelegatesTo(JavaExecSpec.class) Closure closure); - /** * Executes an external Java process. *

      @@ -1044,14 +964,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ExecResult javaexec(Action action); - /** - * Executes an external command. The closure configures a {@link org.gradle.process.ExecSpec}. - * - * @param closure The closure for configuring the execution. - * @return the result of the execution - */ - ExecResult exec(@DelegatesTo(ExecSpec.class) Closure closure); - /** * Executes an external command. *

      @@ -1140,16 +1052,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ AntBuilder createAntBuilder(); - /** - *

      Executes the given closure against the AntBuilder for this project. You can use this in your - * build file to execute ant tasks. The AntBuild is passed to the closure as the closure's - * delegate. See example in javadoc for {@link #getAnt()}

      - * - * @param configureClosure The closure to execute against the AntBuilder. - * @return The AntBuilder. Never returns null. - */ - AntBuilder ant(@DelegatesTo(AntBuilder.class) Closure configureClosure); - /** *

      Executes the given action against the AntBuilder for this project. You can use this in your * build file to execute ant tasks. See example in javadoc for {@link #getAnt()}

      @@ -1187,34 +1089,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ArtifactHandler getArtifacts(); - /** - *

      Configures the published artifacts for this project. - * - *

      This method executes the given closure against the {@link ArtifactHandler} for this project. The {@link - * ArtifactHandler} is passed to the closure as the closure's delegate. - * - *

      Example: - *

      -     * configurations {
      -     *   //declaring new configuration that will be used to associate with artifacts
      -     *   schema
      -     * }
      -     *
      -     * task schemaJar(type: Jar) {
      -     *   //some imaginary task that creates a jar artifact with the schema
      -     * }
      -     *
      -     * //associating the task that produces the artifact with the configuration
      -     * artifacts {
      -     *   //configuration name and the task:
      -     *   schema schemaJar
      -     * }
      -     * 
      - * - * @param configureClosure the closure to use to configure the published artifacts. - */ - void artifacts(@DelegatesTo(ArtifactHandler.class) Closure configureClosure); - /** *

      Configures the published artifacts for this project. * @@ -1287,16 +1161,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void subprojects(Action action); - /** - *

      Configures the sub-projects of this project.

      - * - *

      This method executes the given closure against each of the sub-projects of this project. The target {@link - * Project} is passed to the closure as the closure's delegate.

      - * - * @param configureClosure The closure to execute. - */ - void subprojects(@DelegatesTo(Project.class) Closure configureClosure); - /** *

      Configures this project and each of its sub-projects.

      * @@ -1306,16 +1170,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void allprojects(Action action); - /** - *

      Configures this project and each of its sub-projects.

      - * - *

      This method executes the given closure against this project and its sub-projects. The target {@link Project} - * is passed to the closure as the closure's delegate.

      - * - * @param configureClosure The closure to execute. - */ - void allprojects(@DelegatesTo(Project.class) Closure configureClosure); - /** *

      Adds an action to call immediately before this project is evaluated.

      *

      Passes the project to the action as a parameter. Actions passed to this @@ -1343,24 +1197,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void afterEvaluate(Action action); - /** - *

      Adds a closure to call immediately before this project is evaluated.

      - * - * @see Project#beforeEvaluate(Action) - * - * @param closure The closure to call. - */ - void beforeEvaluate(Closure closure); - - /** - *

      Adds a closure to call immediately after this project is evaluated.

      - * - * @see Project#afterEvaluate(Action) - * - * @param closure The closure to call. - */ - void afterEvaluate(@DelegatesTo(Project.class) Closure closure); - /** *

      Determines if this project has the given property. See here for details of the * properties which are available for a project.

      @@ -1464,44 +1300,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ LoggingManager getLogging(); - /** - *

      Configures an object via a closure, with the closure's delegate set to the supplied object. This way you don't - * have to specify the context of a configuration statement multiple times.

      Instead of:

      - *
      -     * MyType myType = new MyType()
      -     * myType.doThis()
      -     * myType.doThat()
      -     * 
      - *

      you can do: - *

      -     * MyType myType = configure(new MyType()) {
      -     *     doThis()
      -     *     doThat()
      -     * }
      -     * 
      - * - *

      The object being configured is also passed to the closure as a parameter, so you can access it explicitly if - * required:

      - *
      -     * configure(someObj) { obj -> obj.doThis() }
      -     * 
      - * - * @param object The object to configure - * @param configureClosure The closure with configure statements - * @return The configured object - */ - Object configure(Object object, Closure configureClosure); - - /** - * Configures a collection of objects via a closure. This is equivalent to calling {@link #configure(Object, - * groovy.lang.Closure)} for each of the given objects. - * - * @param objects The objects to configure - * @param configureClosure The closure with configure statements - * @return The configured objects. - */ - Iterable configure(Iterable objects, Closure configureClosure); - /** * Configures a collection of objects via an action. * @@ -1571,16 +1369,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ScriptHandler getBuildscript(); - /** - *

      Configures the build script classpath for this project. - * - *

      The given closure is executed against this project's {@link ScriptHandler}. The {@link ScriptHandler} is - * passed to the closure as the closure's delegate. - * - * @param configureClosure the closure to use to configure the build script classpath. - */ - void buildscript(Closure configureClosure); - /** *

      Configures the build script classpath for this project. * @@ -1593,7 +1381,7 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar void buildscript(Action action); /** - * Copies the specified files. The given closure is used to configure a {@link CopySpec}, which is then used to + * Copies the specified files. The given action is used to configure a {@link CopySpec}, which is then used to * copy the files. Example: *

            * copy {
      @@ -1616,22 +1404,13 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar
            * }
            * 
      * - * @param closure Closure to configure the CopySpec - * @return {@link WorkResult} that can be used to check if the copy did any work. - */ - WorkResult copy(@DelegatesTo(CopySpec.class) Closure closure); - - /** - * Copies the specified files. The given action is used to configure a {@link CopySpec}, which is then used to - * copy the files. - * @see #copy(Closure) * @param action Action to configure the CopySpec * @return {@link WorkResult} that can be used to check if the copy did any work. */ WorkResult copy(Action action); /** - * Creates a {@link CopySpec} which can later be used to copy files or create an archive. The given closure is used + * Creates a {@link CopySpec} which can later be used to copy files or create an archive. The given action is used * to configure the {@link CopySpec} before it is returned by this method. * *
      @@ -1646,16 +1425,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar
            * }
            * 
      * - * @param closure Closure to configure the CopySpec - * @return The CopySpec - */ - CopySpec copySpec(@DelegatesTo(CopySpec.class) Closure closure); - - /** - * Creates a {@link CopySpec} which can later be used to copy files or create an archive. The given action is used - * to configure the {@link CopySpec} before it is returned by this method. - * - * @see #copySpec(Closure) * @param action Action to configure the CopySpec * @return The CopySpec */ diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java index a9be8e833f5a3..66ff88e5353eb 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java @@ -83,7 +83,7 @@ * * * @see org.gradle.api.tasks.Copy Copy Task - * @see org.gradle.api.Project#copy(groovy.lang.Closure) Project.copy() + * @see org.gradle.api.Project#copy(Action) Project.copy() */ @HasInternalProtocol public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFilterable { diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index cc775e83bc3a2..e66ae7fbc83a5 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -107,7 +107,6 @@ import org.gradle.internal.service.ServiceRegistry; import org.gradle.internal.service.scopes.ServiceRegistryFactory; import org.gradle.internal.typeconversion.TypeConverter; -import org.gradle.listener.ClosureBackedMethodInvocationDispatch; import org.gradle.model.Model; import org.gradle.model.RuleSource; import org.gradle.model.dsl.internal.NonTransformedModelDslBacking; @@ -148,7 +147,6 @@ import static com.google.common.base.Strings.isNullOrEmpty; import static java.util.Collections.singletonMap; -import static org.gradle.util.internal.ConfigureUtil.configureUsing; import static org.gradle.util.internal.GUtil.addMaps; @NoConventionMapping @@ -689,11 +687,6 @@ public Set getAllprojects(ProjectInternal referrer) { return getCrossProjectModelAccess().getAllprojects(referrer, this); } - @Override - public void allprojects(Closure configureClosure) { - allprojects(this, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public void allprojects(Action action) { allprojects(this, action); @@ -714,11 +707,6 @@ public Set getSubprojects(ProjectInternal referrer) { return getCrossProjectModelAccess().getSubprojects(referrer, this); } - @Override - public void subprojects(Closure configureClosure) { - subprojects(this, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public void subprojects(Action action) { subprojects(this, action); @@ -941,11 +929,6 @@ public ConfigurableFileCollection files(Object... paths) { return getObjects().fileCollection().from(paths); } - @Override - public ConfigurableFileCollection files(Object paths, Closure closure) { - return ConfigureUtil.configure(closure, files(paths)); - } - @Override public ConfigurableFileCollection files(Object paths, Action configureAction) { ConfigurableFileCollection files = files(paths); @@ -958,11 +941,6 @@ public ConfigurableFileTree fileTree(Object baseDir) { return getFileOperations().fileTree(baseDir); } - @Override - public ConfigurableFileTree fileTree(Object baseDir, Closure closure) { - return ConfigureUtil.configure(closure, fileTree(baseDir)); - } - @Override public ConfigurableFileTree fileTree(Object baseDir, Action configureAction) { ConfigurableFileTree fileTree = fileTree(baseDir); @@ -1055,20 +1033,6 @@ public void afterEvaluate(Action action) { failAfterProjectIsEvaluated("afterEvaluate(Action)"); evaluationListener.add("afterEvaluate", getListenerBuildOperationDecorator().decorate("Project.afterEvaluate", action)); } - - @Override - public void beforeEvaluate(Closure closure) { - assertMutatingMethodAllowed("beforeEvaluate(Closure)"); - evaluationListener.add(new ClosureBackedMethodInvocationDispatch("beforeEvaluate", getListenerBuildOperationDecorator().decorate("Project.beforeEvaluate", Cast.>uncheckedNonnullCast(closure)))); - } - - @Override - public void afterEvaluate(Closure closure) { - assertMutatingMethodAllowed("afterEvaluate(Closure)"); - failAfterProjectIsEvaluated("afterEvaluate(Closure)"); - evaluationListener.add(new ClosureBackedMethodInvocationDispatch("afterEvaluate", getListenerBuildOperationDecorator().decorate("Project.afterEvaluate", Cast.>uncheckedNonnullCast(closure)))); - } - private void failAfterProjectIsEvaluated(String methodPrototype) { if (!state.isUnconfigured() && !state.isConfiguring()) { throw new InvalidUserCodeException("Cannot run Project." + methodPrototype + " when the project is already evaluated."); @@ -1123,11 +1087,6 @@ public boolean hasProperty(String propertyName) { }); } - @Override - public WorkResult copy(Closure closure) { - return copy(configureUsing(closure)); - } - @Override public WorkResult copy(Action action) { return getFileOperations().copy(action); @@ -1138,11 +1097,6 @@ public WorkResult sync(Action action) { return getFileOperations().sync(action); } - @Override - public CopySpec copySpec(Closure closure) { - return ConfigureUtil.configure(closure, copySpec()); - } - @Override public CopySpec copySpec(Action action) { return Actions.with(copySpec(), action); @@ -1157,21 +1111,11 @@ public CopySpec copySpec() { @Inject public abstract ProcessOperations getProcessOperations(); - @Override - public ExecResult javaexec(Closure closure) { - return javaexec(configureUsing(closure)); - } - @Override public ExecResult javaexec(Action action) { return getProcessOperations().javaexec(action); } - @Override - public ExecResult exec(Closure closure) { - return exec(configureUsing(closure)); - } - @Override public ExecResult exec(Action action) { return getProcessOperations().exec(action); @@ -1190,12 +1134,6 @@ public ServiceRegistryFactory getServiceRegistryFactory() { @Override @Inject public abstract DependencyMetaDataProvider getDependencyMetaDataProvider(); - - @Override - public AntBuilder ant(Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, getAnt()); - } - @Override public AntBuilder ant(Action configureAction) { AntBuilder ant = getAnt(); @@ -1203,11 +1141,6 @@ public AntBuilder ant(Action configureAction) { return ant; } - @Override - public Project project(String path, Closure configureClosure) { - return project(this, path, ConfigureUtil.configureUsing(configureClosure)); - } - @Override public Project project(String path, Action configureAction) { return project(this, path, configureAction); @@ -1219,20 +1152,6 @@ public ProjectInternal project(ProjectInternal referrer, String path, Action configure(Iterable objects, Closure configureClosure) { - for (Object object : objects) { - configure(object, configureClosure); - } - return objects; - } - @Override public void configurations(Closure configureClosure) { ((Configurable) getConfigurations()).configure(configureClosure); @@ -1248,21 +1167,11 @@ public void dependencies(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getDependencies()); } - @Override - public void artifacts(Closure configureClosure) { - ConfigureUtil.configure(configureClosure, getArtifacts()); - } - @Override public void artifacts(Action configureAction) { configureAction.execute(getArtifacts()); } - @Override - public void buildscript(Closure configureClosure) { - buildscript(ConfigureUtil.configureUsing(configureClosure)); - } - @Override public void buildscript(Action action) { Actions.with(getBuildscript(), action); @@ -1282,15 +1191,6 @@ public Task task(String task, Action configureAction) { return taskContainer.create(task, configureAction); } - @Override - public Task task(String task, Closure configureClosure) { - return taskContainer.create(task).configure(ConfigureUtil.configureUsing(configureClosure)); - } - - public Task task(Object task, Closure configureClosure) { - return task(task.toString(), configureClosure); - } - @Override public Task task(Map options, String task) { return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))); @@ -1305,10 +1205,6 @@ public Task task(Map options, String task, Closure configureClosure) { return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); } - public Task task(Map options, Object task, Closure configureClosure) { - return task(options, task.toString(), configureClosure); - } - @Inject @Override public abstract ProjectConfigurationActionContainer getConfigurationActions(); diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index cfee625788b12..a4f6530b9783b 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -77,9 +77,6 @@ abstract class ProjectDelegate : Project { override fun afterEvaluate(action: Action) = delegate.afterEvaluate(action) - override fun afterEvaluate(closure: Closure<*>) = - delegate.afterEvaluate(closure) - override fun getDefaultTasks(): MutableList = delegate.defaultTasks @@ -115,9 +112,6 @@ abstract class ProjectDelegate : Project { override fun uri(path: Any): URI = delegate.uri(path) - override fun copySpec(closure: Closure<*>): CopySpec = - delegate.copySpec(closure) - override fun copySpec(action: Action): CopySpec = delegate.copySpec(action) @@ -133,15 +127,9 @@ abstract class ProjectDelegate : Project { override fun beforeEvaluate(action: Action) = delegate.beforeEvaluate(action) - override fun beforeEvaluate(closure: Closure<*>) = - delegate.beforeEvaluate(closure) - override fun property(propertyName: String): Any? = delegate.property(propertyName) - override fun buildscript(configureClosure: Closure<*>) = - delegate.buildscript(configureClosure) - override fun buildscript(action: Action) { delegate.buildscript(action) } @@ -161,9 +149,6 @@ abstract class ProjectDelegate : Project { override fun allprojects(action: Action) = delegate.allprojects(action) - override fun allprojects(configureClosure: Closure<*>) = - delegate.allprojects(configureClosure) - override fun container(type: Class): NamedDomainObjectContainer = delegate.container(type) @@ -179,18 +164,9 @@ abstract class ProjectDelegate : Project { override fun evaluationDependsOnChildren() = delegate.evaluationDependsOnChildren() - override fun configure(`object`: Any, configureClosure: Closure<*>): Any = - delegate.configure(`object`, configureClosure) - - override fun configure(objects: Iterable<*>, configureClosure: Closure<*>): Iterable<*> = - delegate.configure(objects, configureClosure) - override fun configure(objects: Iterable, configureAction: Action): Iterable = delegate.configure(objects, configureAction) - override fun exec(closure: Closure<*>): ExecResult = - delegate.exec(closure) - override fun exec(action: Action): ExecResult = delegate.exec(action) @@ -215,9 +191,6 @@ abstract class ProjectDelegate : Project { override fun files(vararg paths: Any?): ConfigurableFileCollection = delegate.files(*paths) - override fun files(paths: Any, configureClosure: Closure<*>): ConfigurableFileCollection = - delegate.files(paths, configureClosure) - override fun files(paths: Any, configureAction: Action): ConfigurableFileCollection = delegate.files(paths, configureAction) @@ -243,9 +216,6 @@ abstract class ProjectDelegate : Project { override fun compareTo(other: Project?): Int = delegate.compareTo(other) - override fun artifacts(configureClosure: Closure<*>) = - delegate.artifacts(configureClosure) - override fun artifacts(configureAction: Action) = delegate.artifacts(configureAction) @@ -280,9 +250,6 @@ abstract class ProjectDelegate : Project { override fun project(path: String): Project = delegate.project(path) - override fun project(path: String, configureClosure: Closure<*>): Project = - delegate.project(path, configureClosure) - override fun project(path: String, configureAction: Action): Project = delegate.project(path, configureAction) @@ -295,15 +262,9 @@ abstract class ProjectDelegate : Project { override fun task(args: Map, name: String, configureClosure: Closure<*>): Task = delegate.task(args, name, configureClosure) - override fun task(name: String, configureClosure: Closure<*>): Task = - delegate.task(name, configureClosure) - override fun task(name: String, configureAction: Action): Task = delegate.task(name, configureAction) - override fun copy(closure: Closure<*>): WorkResult = - delegate.copy(closure) - override fun copy(action: Action): WorkResult = delegate.copy(action) @@ -313,9 +274,6 @@ abstract class ProjectDelegate : Project { override fun subprojects(action: Action) = delegate.subprojects(action) - override fun subprojects(configureClosure: Closure<*>) = - delegate.subprojects(configureClosure) - override fun getBuildscript(): ScriptHandler = delegate.buildscript @@ -354,9 +312,6 @@ abstract class ProjectDelegate : Project { override fun evaluationDependsOn(path: String): Project = delegate.evaluationDependsOn(path) - override fun javaexec(closure: Closure<*>): ExecResult = - delegate.javaexec(closure) - override fun javaexec(action: Action): ExecResult = delegate.javaexec(action) @@ -384,9 +339,6 @@ abstract class ProjectDelegate : Project { override fun getPlugins(): PluginContainer = delegate.plugins - override fun ant(configureClosure: Closure<*>): AntBuilder = - delegate.ant(configureClosure) - override fun ant(configureAction: Action): AntBuilder = delegate.ant(configureAction) @@ -436,9 +388,6 @@ abstract class ProjectDelegate : Project { override fun fileTree(baseDir: Any): ConfigurableFileTree = delegate.fileTree(baseDir) - override fun fileTree(baseDir: Any, configureClosure: Closure<*>): ConfigurableFileTree = - delegate.fileTree(baseDir, configureClosure) - override fun fileTree(baseDir: Any, configureAction: Action): ConfigurableFileTree = delegate.fileTree(baseDir, configureAction) From fbac41c38590ddad75fc96b076ef954673bbe2ff Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:14:57 -0400 Subject: [PATCH 16/40] Add missing Action-taking methods for Project --- ...ProblemReportingCrossProjectModelAccess.kt | 21 ++++++- .../src/main/java/org/gradle/api/Project.java | 60 +++++++++++++++++++ .../api/internal/project/DefaultProject.java | 21 +++++++ .../dsl/support/delegates/ProjectDelegate.kt | 15 +++++ 4 files changed, 116 insertions(+), 1 deletion(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index 9b3869fafba87..424feac9daca6 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -94,7 +94,6 @@ import org.gradle.process.ExecResult import org.gradle.process.ExecSpec import org.gradle.process.JavaExecSpec import org.gradle.util.Path -import org.gradle.util.internal.ConfigureUtil import java.io.File import java.net.URI import java.util.concurrent.Callable @@ -305,6 +304,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.task(args, name, configureClosure) } + override fun task(args: MutableMap, name: String, action: Action): Task { + onAccess() + return delegate.task(args, name, action) + } + override fun task(name: String, configureAction: Action): Task { onAccess() return delegate.task(name, configureAction) @@ -486,6 +490,11 @@ class ProblemReportingCrossProjectModelAccess( delegate.configurations(configureClosure) } + override fun configurations(action: Action) { + onAccess() + delegate.configurations(action) + } + override fun getArtifacts(): ArtifactHandler { onAccess() return delegate.artifacts @@ -606,6 +615,11 @@ class ProblemReportingCrossProjectModelAccess( delegate.repositories(configureClosure) } + override fun repositories(action: Action) { + onAccess() + delegate.repositories(action) + } + override fun getDependencies(): DependencyHandler { onAccess() return delegate.dependencies @@ -616,6 +630,11 @@ class ProblemReportingCrossProjectModelAccess( delegate.dependencies(configureClosure) } + override fun dependencies(action: Action) { + onAccess() + delegate.dependencies(action) + } + override fun getDependencyFactory(): DependencyFactory { onAccess() return delegate.dependencyFactory diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 19eeab5efcfef..5b4802d562994 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -506,6 +506,27 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Task task(Map args, String name, Closure configureClosure); + /** + *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given + * closure is executed to configure the task. A map of creation options can be passed to this method to control how + * the task is created. See {@link #task(java.util.Map, String)} for the available options.

      + * + *

      After the task is added to the project, it is made available as a property of the project, so that you can + * reference the task by name in your build file. See here for more details

      + * + *

      If a task with the given name already exists in this project and the override option is not set + * to true, an exception is thrown.

      + * + * @param args The task creation options. + * @param name The name of the task to be created + * @param action The action to use to configure the created task. + * @return The newly created task object + * @throws InvalidUserDataException If a task with the given name already exists in this project. + * + * @since 8.0 + */ + Task task(Map args, String name, Action action); + /** *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given * action is executed to configure the task.

      After the task is added to the project, it is made @@ -1083,6 +1104,20 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void configurations(Closure configureClosure); + /** + *

      Configures the dependency configurations for this project. + * + *

      This method executes the given action against the {@link ConfigurationContainer} + * for this project. + * + *

      Examples:

      See docs for {@link ConfigurationContainer} + * + * @param action the action to use to configure the dependency configurations. + * + * @since 8.0 + */ + void configurations(Action action); + /** * Returns a handler for assigning artifacts produced by the project to configurations. *

      Examples:

      See docs for {@link ArtifactHandler} @@ -1327,6 +1362,17 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void repositories(Closure configureClosure); + /** + *

      Configures the repositories for this project. + * + *

      This method executes the given action against the {@link RepositoryHandler} for this project. + * + * @param action the action to use to configure the repositories. + * + * @since 8.0 + */ + void repositories(Action action); + /** * Returns the dependency handler of this project. The returned dependency handler instance can be used for adding * new dependencies. For accessing already declared dependencies, the configurations can be used. @@ -1352,6 +1398,20 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void dependencies(Closure configureClosure); + /** + *

      Configures the dependencies for this project. + * + *

      This method executes the given action against the {@link DependencyHandler} for this project. + * + *

      Examples:

      + * See docs for {@link DependencyHandler} + * + * @param action the action to use to configure the dependencies. + * + * @since 8.0 + */ + void dependencies(Action action); + /** * Provides access to methods to create various kinds of {@link org.gradle.api.artifacts.Dependency Dependency} instances. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index e66ae7fbc83a5..fab9c86b94984 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -1157,16 +1157,31 @@ public void configurations(Closure configureClosure) { ((Configurable) getConfigurations()).configure(configureClosure); } + @Override + public void configurations(Action action) { + Actions.with(getConfigurations(), action); + } + @Override public void repositories(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getRepositories()); } + @Override + public void repositories(Action action) { + Actions.with(getRepositories(), action); + } + @Override public void dependencies(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getDependencies()); } + @Override + public void dependencies(Action action) { + Actions.with(getDependencies(), action); + } + @Override public void artifacts(Action configureAction) { configureAction.execute(getArtifacts()); @@ -1205,6 +1220,12 @@ public Task task(Map options, String task, Closure configureClosure) { return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); } + @Override + public Task task(Map options, String name, Action action) { + Task task = taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, name))); + return Actions.with(task, action); + } + @Inject @Override public abstract ProjectConfigurationActionContainer getConfigurationActions(); diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index a4f6530b9783b..d09252ea99a87 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -140,6 +140,10 @@ abstract class ProjectDelegate : Project { override fun dependencies(configureClosure: Closure<*>) = delegate.dependencies(configureClosure) + override fun dependencies(action: Action) { + delegate.dependencies(action) + } + override fun getPath(): String = delegate.path @@ -161,6 +165,10 @@ abstract class ProjectDelegate : Project { override fun repositories(configureClosure: Closure<*>) = delegate.repositories(configureClosure) + override fun repositories(action: Action) { + delegate.repositories(action) + } + override fun evaluationDependsOnChildren() = delegate.evaluationDependsOnChildren() @@ -176,6 +184,10 @@ abstract class ProjectDelegate : Project { override fun configurations(configureClosure: Closure<*>) = delegate.configurations(configureClosure) + override fun configurations(action: Action) { + delegate.configurations(action) + } + override fun getExtensions(): ExtensionContainer = delegate.extensions @@ -262,6 +274,9 @@ abstract class ProjectDelegate : Project { override fun task(args: Map, name: String, configureClosure: Closure<*>): Task = delegate.task(args, name, configureClosure) + override fun task(args: MutableMap, name: String, action: Action): Task = + delegate.task(args, name, action) + override fun task(name: String, configureAction: Action): Task = delegate.task(name, configureAction) From e343a51b6dfbc2dd2f8493abca0e1403b15cc7e0 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:18:05 -0400 Subject: [PATCH 17/40] Remove Closure methods from PluginAware --- .../CrossProjectConfigurationReportingGradle.kt | 3 --- .../ProblemReportingCrossProjectModelAccess.kt | 5 ----- .../java/org/gradle/api/plugins/PluginAware.java | 16 +--------------- .../internal/project/AbstractPluginAware.java | 6 ------ .../kotlin/dsl/support/PluginAwareScript.kt | 4 ---- .../dsl/support/delegates/GradleDelegate.kt | 3 --- .../dsl/support/delegates/ProjectDelegate.kt | 3 --- .../dsl/support/delegates/SettingsDelegate.kt | 4 ---- 8 files changed, 1 insertion(+), 43 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt index 32e7eaa3c6fb0..ebac00b9417da 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt @@ -207,9 +207,6 @@ class CrossProjectConfigurationReportingGradle private constructor( override fun getPlugins(): PluginContainer = delegate.plugins - override fun apply(closure: Closure<*>) = - delegate.apply(closure) - override fun apply(action: Action) = delegate.apply(action) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index 424feac9daca6..f6f26df3decbf 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -715,11 +715,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.plugins } - override fun apply(closure: Closure<*>) { - onAccess() - delegate.apply(closure) - } - override fun apply(action: Action) { onAccess() delegate.apply(action) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginAware.java b/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginAware.java index e9c05e6743d78..8654b73d840e1 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginAware.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginAware.java @@ -16,8 +16,6 @@ package org.gradle.api.plugins; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.internal.HasInternalProtocol; @@ -43,23 +41,11 @@ public interface PluginAware { * Use {@link PluginManager#hasPlugin(String)} or similar to query for the application of plugins instead of doing so via the plugin container. * * @return the plugin container - * @see #apply + * @see #apply(Action) * @see PluginManager#hasPlugin(String) */ PluginContainer getPlugins(); - /** - * Applies zero or more plugins or scripts. - *

      - * The given closure is used to configure an {@link ObjectConfigurationAction}, which “builds” the plugin application. - *

      - * This method differs from {@link #apply(java.util.Map)} in that it allows methods of the configuration action to be invoked more than once. - * - * @param closure the closure to configure an {@link ObjectConfigurationAction} with before “executing” it - * @see #apply(java.util.Map) - */ - void apply(@DelegatesTo(ObjectConfigurationAction.class) Closure closure); - /** * Applies zero or more plugins or scripts. *

      diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/AbstractPluginAware.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/AbstractPluginAware.java index e53bdd97fb090..a43fc28244d1b 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/AbstractPluginAware.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/AbstractPluginAware.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.project; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.internal.plugins.DefaultObjectConfigurationAction; import org.gradle.api.internal.plugins.PluginAwareInternal; @@ -30,11 +29,6 @@ public abstract class AbstractPluginAware implements PluginAwareInternal { - @Override - public void apply(Closure closure) { - apply(ConfigureUtil.configureUsing(closure)); - } - @Override public void apply(Action action) { DefaultObjectConfigurationAction configAction = createObjectConfigurationAction(); diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/PluginAwareScript.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/PluginAwareScript.kt index 407793672b712..493ec538f9136 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/PluginAwareScript.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/PluginAwareScript.kt @@ -16,7 +16,6 @@ package org.gradle.kotlin.dsl.support -import groovy.lang.Closure import org.gradle.api.Action import org.gradle.api.plugins.ObjectConfigurationAction import org.gradle.api.plugins.PluginAware @@ -39,7 +38,4 @@ open class PluginAwareScript( override fun apply(options: Map) = host.applyObjectConfigurationAction(options) - - override fun apply(closure: Closure) = - internalError() } diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt index ff03da654da29..a5bb682d57f44 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt @@ -144,9 +144,6 @@ abstract class GradleDelegate : Gradle { override fun getPlugins(): PluginContainer = delegate.plugins - override fun apply(closure: Closure) = - delegate.apply(closure) - override fun apply(action: Action) = delegate.apply(action) diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index d09252ea99a87..1b6d2a139018a 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -315,9 +315,6 @@ abstract class ProjectDelegate : Project { override fun getLayout(): ProjectLayout = delegate.layout - override fun apply(closure: Closure<*>) = - delegate.apply(closure) - override fun apply(action: Action) = delegate.apply(action) diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/SettingsDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/SettingsDelegate.kt index 991f38a20945f..90da01423bc48 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/SettingsDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/SettingsDelegate.kt @@ -16,7 +16,6 @@ package org.gradle.kotlin.dsl.support.delegates -import groovy.lang.Closure import org.gradle.StartParameter import org.gradle.api.Action import org.gradle.api.initialization.ConfigurableIncludedBuild @@ -108,9 +107,6 @@ abstract class SettingsDelegate : Settings { override fun getPlugins(): PluginContainer = delegate.plugins - override fun apply(closure: Closure) = - delegate.apply(closure) - override fun apply(action: Action) = delegate.apply(action) From 6ffcc30d40af209571e189b399d389dda514169d Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:22:38 -0400 Subject: [PATCH 18/40] Remove the rest of the Closure taking methods from Project --- ...ProblemReportingCrossProjectModelAccess.kt | 26 ------- .../src/main/java/org/gradle/api/Project.java | 75 +------------------ .../api/internal/project/DefaultProject.java | 22 ------ .../dsl/support/delegates/ProjectDelegate.kt | 16 ---- 4 files changed, 3 insertions(+), 136 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index f6f26df3decbf..c854abe40bdd1 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -16,7 +16,6 @@ package org.gradle.configurationcache -import groovy.lang.Closure import groovy.lang.GroovyObjectSupport import groovy.lang.Script import org.gradle.api.Action @@ -299,11 +298,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.task(args, name) } - override fun task(args: MutableMap, name: String, configureClosure: Closure<*>): Task { - onAccess() - return delegate.task(args, name, configureClosure) - } - override fun task(args: MutableMap, name: String, action: Action): Task { onAccess() return delegate.task(args, name, action) @@ -485,11 +479,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.configurations } - override fun configurations(configureClosure: Closure<*>) { - onAccess() - delegate.configurations(configureClosure) - } - override fun configurations(action: Action) { onAccess() delegate.configurations(action) @@ -610,11 +599,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.repositories } - override fun repositories(configureClosure: Closure<*>) { - onAccess() - delegate.repositories(configureClosure) - } - override fun repositories(action: Action) { onAccess() delegate.repositories(action) @@ -625,11 +609,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.dependencies } - override fun dependencies(configureClosure: Closure<*>) { - onAccess() - delegate.dependencies(configureClosure) - } - override fun dependencies(action: Action) { onAccess() delegate.dependencies(action) @@ -675,11 +654,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.container(type, factory) } - override fun container(type: Class, factoryClosure: Closure<*>): NamedDomainObjectContainer { - onAccess() - return delegate.container(type, factoryClosure) - } - override fun getResources(): ResourceHandler { onAccess() return delegate.resources diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 5b4802d562994..3ddcdd9a0508b 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -16,7 +16,6 @@ package org.gradle.api; -import groovy.lang.Closure; import groovy.lang.MissingPropertyException; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.dsl.ArtifactHandler; @@ -206,8 +205,7 @@ * *

    • The tasks of the project. A method is added for each task, using the name of the task as the method name and * taking a single {@link org.gradle.api.Action} parameter. The method calls the {@link Task#configure(Action)} method for the - * associated task with the provided closure. For example, if the project has a task called compile, then a - * method is added with the following signature: void compile(Closure configureClosure).
    • + * associated task with the provided configuration. * *
    • The methods of the parent project, recursively up to the root project.
    • * @@ -487,25 +485,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Task task(Map args, String name) throws InvalidUserDataException; - /** - *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given - * closure is executed to configure the task. A map of creation options can be passed to this method to control how - * the task is created. See {@link #task(java.util.Map, String)} for the available options.

      - * - *

      After the task is added to the project, it is made available as a property of the project, so that you can - * reference the task by name in your build file. See here for more details

      - * - *

      If a task with the given name already exists in this project and the override option is not set - * to true, an exception is thrown.

      - * - * @param args The task creation options. - * @param name The name of the task to be created - * @param configureClosure The closure to use to configure the created task. - * @return The newly created task object - * @throws InvalidUserDataException If a task with the given name already exists in this project. - */ - Task task(Map args, String name, Closure configureClosure); - /** *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given * closure is executed to configure the task. A map of creation options can be passed to this method to control how @@ -670,7 +649,7 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar * *

    • A {@link org.gradle.api.resources.TextResource}.
    • * - *
    • A Groovy {@link Closure} or Kotlin function that returns any supported type. The closure's return value is resolved recursively.
    • + *
    • A Groovy {@link groovy.lang.Closure} or Kotlin function that returns any supported type. The closure's return value is resolved recursively.
    • * *
    • A {@link java.util.concurrent.Callable} that returns any supported type. The callable's return value is resolved recursively.
    • * @@ -736,7 +715,7 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar * *
    • A {@link java.util.concurrent.Callable} that returns any supported type. The return value of the {@code call()} method is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • * - *
    • A Groovy {@link Closure} or Kotlin function that returns any of the types listed here. The return value of the closure is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • + *
    • A Groovy {@link groovy.lang.Closure} or Kotlin function that returns any of the types listed here. The return value of the closure is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • * *
    • A {@link Task}. Converted to the task's output files. The task is executed if the file collection is used as an input to another task.
    • * @@ -1092,18 +1071,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ConfigurationContainer getConfigurations(); - /** - *

      Configures the dependency configurations for this project. - * - *

      This method executes the given closure against the {@link ConfigurationContainer} - * for this project. The {@link ConfigurationContainer} is passed to the closure as the closure's delegate. - * - *

      Examples:

      See docs for {@link ConfigurationContainer} - * - * @param configureClosure the closure to use to configure the dependency configurations. - */ - void configurations(Closure configureClosure); - /** *

      Configures the dependency configurations for this project. * @@ -1352,16 +1319,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ RepositoryHandler getRepositories(); - /** - *

      Configures the repositories for this project. - * - *

      This method executes the given closure against the {@link RepositoryHandler} for this project. The {@link - * RepositoryHandler} is passed to the closure as the closure's delegate. - * - * @param configureClosure the closure to use to configure the repositories. - */ - void repositories(Closure configureClosure); - /** *

      Configures the repositories for this project. * @@ -1385,19 +1342,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ DependencyHandler getDependencies(); - /** - *

      Configures the dependencies for this project. - * - *

      This method executes the given closure against the {@link DependencyHandler} for this project. The {@link - * DependencyHandler} is passed to the closure as the closure's delegate. - * - *

      Examples:

      - * See docs for {@link DependencyHandler} - * - * @param configureClosure the closure to use to configure the dependencies. - */ - void dependencies(Closure configureClosure); - /** *

      Configures the dependencies for this project. * @@ -1564,19 +1508,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ NamedDomainObjectContainer container(Class type, NamedDomainObjectFactory factory); - /** - *

      Creates a container for managing named objects of the specified type. The given closure is used to create object instances. The name of the instance to be created is passed as a parameter to - * the closure.

      - * - *

      All objects MUST expose their name as a bean property named "name". The name must be constant for the life of the object.

      - * - * @param type The type of objects for the container to contain. - * @param factoryClosure The closure to use to create object instances. - * @param The type of objects for the container to contain. - * @return The container. - */ - NamedDomainObjectContainer container(Class type, Closure factoryClosure); - /** * Allows adding DSL extensions to the project. Useful for plugin authors. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index fab9c86b94984..9c21b95f05814 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -127,10 +127,8 @@ import org.gradle.process.ExecResult; import org.gradle.process.ExecSpec; import org.gradle.process.JavaExecSpec; -import org.gradle.util.Configurable; import org.gradle.util.Path; import org.gradle.util.internal.ClosureBackedAction; -import org.gradle.util.internal.ConfigureUtil; import javax.annotation.Nullable; import javax.inject.Inject; @@ -1152,31 +1150,17 @@ public ProjectInternal project(ProjectInternal referrer, String path, Action) getConfigurations()).configure(configureClosure); - } @Override public void configurations(Action action) { Actions.with(getConfigurations(), action); } - @Override - public void repositories(Closure configureClosure) { - ConfigureUtil.configure(configureClosure, getRepositories()); - } - @Override public void repositories(Action action) { Actions.with(getRepositories(), action); } - @Override - public void dependencies(Closure configureClosure) { - ConfigureUtil.configure(configureClosure, getDependencies()); - } - @Override public void dependencies(Action action) { Actions.with(getDependencies(), action); @@ -1215,11 +1199,6 @@ public Task task(Map options, Object task) { return task(options, task.toString()); } - @Override - public Task task(Map options, String task, Closure configureClosure) { - return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); - } - @Override public Task task(Map options, String name, Action action) { Task task = taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, name))); @@ -1277,7 +1256,6 @@ public NamedDomainObjectContainer container(Class type, NamedDomainObj return getServices().get(DomainObjectCollectionFactory.class).newNamedDomainObjectContainer(type, factory); } - @Override public NamedDomainObjectContainer container(Class type, Closure factoryClosure) { return getServices().get(DomainObjectCollectionFactory.class).newNamedDomainObjectContainer(type, factoryClosure); } diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index 1b6d2a139018a..f0ce9ac066481 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -16,7 +16,6 @@ package org.gradle.kotlin.dsl.support.delegates -import groovy.lang.Closure import org.gradle.api.Action import org.gradle.api.AntBuilder import org.gradle.api.NamedDomainObjectContainer @@ -137,9 +136,6 @@ abstract class ProjectDelegate : Project { override fun getProject(): Project = delegate.project - override fun dependencies(configureClosure: Closure<*>) = - delegate.dependencies(configureClosure) - override fun dependencies(action: Action) { delegate.dependencies(action) } @@ -159,12 +155,6 @@ abstract class ProjectDelegate : Project { override fun container(type: Class, factory: NamedDomainObjectFactory): NamedDomainObjectContainer = delegate.container(type, factory) - override fun container(type: Class, factoryClosure: Closure<*>): NamedDomainObjectContainer = - delegate.container(type, factoryClosure) - - override fun repositories(configureClosure: Closure<*>) = - delegate.repositories(configureClosure) - override fun repositories(action: Action) { delegate.repositories(action) } @@ -181,9 +171,6 @@ abstract class ProjectDelegate : Project { override fun sync(action: Action): WorkResult = delegate.sync(action) - override fun configurations(configureClosure: Closure<*>) = - delegate.configurations(configureClosure) - override fun configurations(action: Action) { delegate.configurations(action) } @@ -271,9 +258,6 @@ abstract class ProjectDelegate : Project { override fun task(args: Map, name: String): Task = delegate.task(args, name) - override fun task(args: Map, name: String, configureClosure: Closure<*>): Task = - delegate.task(args, name, configureClosure) - override fun task(args: MutableMap, name: String, action: Action): Task = delegate.task(args, name, action) From 1b01fc06b71dc5b52537ffcccb220f77602c7580 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:23:30 -0400 Subject: [PATCH 19/40] Remove explicit reference to configure(Closure) in NamedDomainObjectContainer The interface is good enough --- .../org/gradle/api/NamedDomainObjectContainer.java | 12 ------------ .../delegates/NamedDomainObjectContainerDelegate.kt | 3 +++ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java index 8cae8cbaf8cdf..87777dabad1b6 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/NamedDomainObjectContainer.java @@ -15,7 +15,6 @@ */ package org.gradle.api; -import groovy.lang.Closure; import org.gradle.api.provider.Provider; import org.gradle.util.Configurable; @@ -61,17 +60,6 @@ public interface NamedDomainObjectContainer extends NamedDomainObjectSet, */ T create(String name, Action configureAction) throws InvalidUserDataException; - /** - *

      Allows the container to be configured, creating missing objects as they are referenced.

      - * - *

      TODO: example usage

      - * - * @param configureClosure The closure to configure this container with - * @return This. - */ - @Override - NamedDomainObjectContainer configure(Closure configureClosure); - /** * Defines a new object, which will be created and configured when it is required. An object is 'required' when the object is located using query methods such as {@link NamedDomainObjectCollection#getByName(java.lang.String)} or when {@link Provider#get()} is called on the return value of this method. * diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt index 8a83ba5ab866c..d4810b5c3608c 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/NamedDomainObjectContainerDelegate.kt @@ -64,6 +64,9 @@ abstract class NamedDomainObjectContainerDelegate : NamedDomainObjectCo override fun configure(configureClosure: Closure): NamedDomainObjectContainer = delegate.configure(configureClosure) + override fun configure(action: Action>?): NamedDomainObjectContainer = + delegate.configure(action) + override fun addAllLater(provider: Provider>) = delegate.addAllLater(provider) From 57934880e947ba22f102f6736712a9c4221a8a19 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:27:13 -0400 Subject: [PATCH 20/40] Remove Closure methods from TaskExecutionGraph --- .../api/execution/TaskExecutionGraph.java | 32 +------------------ .../taskgraph/DefaultTaskExecutionGraph.java | 28 ---------------- .../DefaultTaskExecutionGraphSpec.groovy | 8 ----- .../GradleEnterprisePluginService.java | 2 +- 4 files changed, 2 insertions(+), 68 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/execution/TaskExecutionGraph.java b/subprojects/core-api/src/main/java/org/gradle/api/execution/TaskExecutionGraph.java index f17f045c683a9..9a1f6a1fc3778 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/execution/TaskExecutionGraph.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/execution/TaskExecutionGraph.java @@ -15,7 +15,6 @@ */ package org.gradle.api.execution; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Task; @@ -32,7 +31,7 @@ * *

      The TaskExecutionGraph is populated only after all the projects in the build have been evaluated. It * is empty before then. You can receive a notification when the graph is populated, using {@link - * #whenReady(groovy.lang.Closure)} or {@link #addTaskExecutionGraphListener(TaskExecutionGraphListener)}.

      + * #whenReady(Action)} or {@link #addTaskExecutionGraphListener(TaskExecutionGraphListener)}.

      */ public interface TaskExecutionGraph { /** @@ -67,14 +66,6 @@ public interface TaskExecutionGraph { @Deprecated void removeTaskExecutionListener(TaskExecutionListener listener); - /** - *

      Adds a closure to be called when this graph has been populated. This graph is passed to the closure as a - * parameter.

      - * - * @param closure The closure to execute when this graph has been populated. - */ - void whenReady(Closure closure); - /** *

      Adds an action to be called when this graph has been populated. This graph is passed to the action as a * parameter.

      @@ -85,16 +76,6 @@ public interface TaskExecutionGraph { */ void whenReady(Action action); - /** - *

      Adds a closure to be called immediately before a task is executed. The task is passed to the closure as a - * parameter.

      - * - * @param closure The closure to execute when a task is about to be executed. - * @deprecated This method is not supported when configuration caching is enabled. - */ - @Deprecated - void beforeTask(Closure closure); - /** *

      Adds an action to be called immediately before a task is executed. The task is passed to the action as a * parameter.

      @@ -107,17 +88,6 @@ public interface TaskExecutionGraph { @Deprecated void beforeTask(Action action); - /** - *

      Adds a closure to be called immediately after a task has executed. The task is passed to the closure as the - * first parameter. A {@link org.gradle.api.tasks.TaskState} is passed as the second parameter. Both parameters are - * optional.

      - * - * @param closure The closure to execute when a task has been executed - * @deprecated This method is not supported when configuration caching is enabled. - */ - @Deprecated - void afterTask(Closure closure); - /** *

      Adds an action to be called immediately after a task has executed. The task is passed to the action as the * first parameter.

      diff --git a/subprojects/core/src/main/java/org/gradle/execution/taskgraph/DefaultTaskExecutionGraph.java b/subprojects/core/src/main/java/org/gradle/execution/taskgraph/DefaultTaskExecutionGraph.java index a9f825af6a6a8..cbda9b1d71a37 100644 --- a/subprojects/core/src/main/java/org/gradle/execution/taskgraph/DefaultTaskExecutionGraph.java +++ b/subprojects/core/src/main/java/org/gradle/execution/taskgraph/DefaultTaskExecutionGraph.java @@ -18,7 +18,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.NonNullApi; import org.gradle.api.Task; @@ -36,7 +35,6 @@ import org.gradle.execution.plan.NodeExecutor; import org.gradle.execution.plan.PlanExecutor; import org.gradle.execution.plan.TaskNode; -import org.gradle.internal.Cast; import org.gradle.internal.InternalListener; import org.gradle.internal.build.ExecutionResult; import org.gradle.internal.event.ListenerBroadcast; @@ -47,7 +45,6 @@ import org.gradle.internal.operations.CurrentBuildOperationRef; import org.gradle.internal.operations.RunnableBuildOperation; import org.gradle.internal.service.ServiceRegistry; -import org.gradle.listener.ClosureBackedMethodInvocationDispatch; import org.gradle.util.Path; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -161,19 +158,6 @@ public void removeTaskExecutionGraphListener(TaskExecutionGraphListener listener graphListeners.remove(listener); } - @Override - public void whenReady(final Closure closure) { - graphListeners.add( - new ClosureBackedMethodInvocationDispatch( - "graphPopulated", - listenerBuildOperationDecorator.decorate( - "TaskExecutionGraph.whenReady", - Cast.>uncheckedCast(closure) - ) - ) - ); - } - @Override public void whenReady(final Action action) { graphListeners.add( @@ -192,12 +176,6 @@ public void removeTaskExecutionListener(org.gradle.api.execution.TaskExecutionLi taskListeners.remove(listener); } - @Override - public void beforeTask(final Closure closure) { - notifyListenerRegistration("TaskExecutionGraph.beforeTask", closure); - taskListeners.add(new ClosureBackedMethodInvocationDispatch("beforeExecute", closure)); - } - @Override public void beforeTask(final Action action) { notifyListenerRegistration("TaskExecutionGraph.beforeTask", action); @@ -209,12 +187,6 @@ public void beforeExecute(Task task) { }); } - @Override - public void afterTask(final Closure closure) { - notifyListenerRegistration("TaskExecutionGraph.afterTask", closure); - taskListeners.add(new ClosureBackedMethodInvocationDispatch("afterExecute", closure)); - } - @Override public void afterTask(final Action action) { notifyListenerRegistration("TaskExecutionGraph.afterTask", action); diff --git a/subprojects/core/src/test/groovy/org/gradle/execution/taskgraph/DefaultTaskExecutionGraphSpec.groovy b/subprojects/core/src/test/groovy/org/gradle/execution/taskgraph/DefaultTaskExecutionGraphSpec.groovy index 9aee53224a70c..f957718ec29d0 100644 --- a/subprojects/core/src/test/groovy/org/gradle/execution/taskgraph/DefaultTaskExecutionGraphSpec.groovy +++ b/subprojects/core/src/test/groovy/org/gradle/execution/taskgraph/DefaultTaskExecutionGraphSpec.groovy @@ -419,14 +419,12 @@ class DefaultTaskExecutionGraphSpec extends AbstractExecutionPlanSpec { Task a = task("a") when: - taskGraph.whenReady(closure) taskGraph.whenReady(action) def finalizedPlan = Stub(FinalizedExecutionPlan) taskGraph.populate(finalizedPlan) taskGraph.execute(finalizedPlan) then: - 1 * closure.call() 1 * action.execute(_) then: @@ -485,14 +483,11 @@ class DefaultTaskExecutionGraphSpec extends AbstractExecutionPlanSpec { final Task b = task("b") when: - taskGraph.beforeTask(closure) taskGraph.beforeTask(action) taskExecutionListeners.source.beforeExecute(a) taskExecutionListeners.source.beforeExecute(b) then: - 1 * closure.call(a) - 1 * closure.call(b) 1 * action.execute(a) 1 * action.execute(b) } @@ -507,14 +502,11 @@ class DefaultTaskExecutionGraphSpec extends AbstractExecutionPlanSpec { final Task b = task("b") when: - taskGraph.afterTask(closure) taskGraph.afterTask(action) taskExecutionListeners.source.afterExecute(a, a.state) taskExecutionListeners.source.afterExecute(b, b.state) then: - 1 * closure.call(a) - 1 * closure.call(b) 1 * action.execute(a) 1 * action.execute(b) } diff --git a/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java b/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java index a6c867bf8ef09..5b8cac4b91009 100644 --- a/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java +++ b/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java @@ -36,7 +36,7 @@ public interface GradleEnterprisePluginService { /** * Used to signal a start of the execution of main tasks of a build tree, also known as the "execution phase". * At this point the configuration phase is already completed and all user code related to it finished executing, - * including late callbacks like {@link org.gradle.api.execution.TaskExecutionGraph#whenReady(Closure)}. + * including late callbacks like {@link org.gradle.api.execution.TaskExecutionGraph#whenReady(org.gradle.api.Action)}. * This callback is invoked before any of the tasks of the execution phase starts. * However, the tasks of the included builds that contribute project and settings plugins, and tasks of the buildSrc build * run before the execution phase, at the configuration phase, and, therefore, before this callback. From d7baaf7bcd150e8ae50b07eceafac875b7e84c51 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:44:21 -0400 Subject: [PATCH 21/40] Remove Closure taking methods from file manipulating classes --- .../gradle/api/file/ContentFilterable.java | 13 +--- .../gradle/api/file/CopyProcessingSpec.java | 21 ------ .../org/gradle/api/file/CopySourceSpec.java | 11 ---- .../java/org/gradle/api/file/CopySpec.java | 52 --------------- .../org/gradle/api/file/FileCollection.java | 13 ---- .../java/org/gradle/api/file/FileTree.java | 25 ------- .../org/gradle/api/file/FileVisitDetails.java | 2 +- .../api/tasks/util/PatternFilterable.java | 35 ---------- .../org/gradle/api/tasks/util/PatternSet.java | 14 ---- .../file/DefaultSourceDirectorySet.java | 14 ---- .../internal/file/copy/CopySpecWrapper.java | 48 -------------- .../internal/file/copy/DefaultCopySpec.java | 41 ------------ .../file/copy/DefaultFileCopyDetails.java | 6 -- .../file/copy/DelegatingCopySpecInternal.java | 37 ----------- .../copy/NormalizingCopyActionDecorator.java | 6 -- .../gradle/api/tasks/AbstractCopyTask.java | 65 ------------------- .../java/org/gradle/api/tasks/SourceTask.java | 19 ------ .../tasks/bundling/AbstractArchiveTask.java | 16 ----- .../internal/file/AbstractFileCollection.java | 7 -- .../api/internal/file/AbstractFileTree.java | 18 ----- .../api/internal/file/CompositeFileTree.java | 17 ----- .../file/DefaultFileCollectionFactory.java | 6 -- .../DefaultConfigurableFileTree.java | 13 ---- .../org/gradle/api/tasks/testing/Test.java | 18 ----- 24 files changed, 2 insertions(+), 515 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/ContentFilterable.java b/subprojects/core-api/src/main/java/org/gradle/api/file/ContentFilterable.java index f60238ee788d3..1b2fd9e695b78 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/ContentFilterable.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/ContentFilterable.java @@ -15,7 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.Transformer; @@ -63,17 +62,7 @@ public interface ContentFilterable { ContentFilterable filter(Class filterType); /** - * Adds a content filter based on the provided closure. The Closure will be called with each line (stripped of line - * endings) and should return a String to replace the line or {@code null} to remove the line. If every line is - * removed, the result will be an empty file, not an absent one. - * - * @param closure to implement line based filtering - * @return this - */ - ContentFilterable filter(Closure closure); - - /** - * Adds a content filter based on the provided transformer. The Closure will be called with each line (stripped of line + * Adds a content filter based on the provided transformer. The transformer will be called with each line (stripped of line * endings) and should return a String to replace the line or {@code null} to remove the line. If every line is * removed, the result will be an empty file, not an absent one. * diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/CopyProcessingSpec.java b/subprojects/core-api/src/main/java/org/gradle/api/file/CopyProcessingSpec.java index ce863ca546a27..33563ff600e50 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/CopyProcessingSpec.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/CopyProcessingSpec.java @@ -15,8 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Transformer; @@ -36,16 +34,6 @@ public interface CopyProcessingSpec extends ContentFilterable { */ CopyProcessingSpec into(Object destPath); - /** - * Renames a source file. The closure will be called with a single parameter, the name of the file. - * The closure should return a String object with a new target name. The closure may return null, - * in which case the original name will be used. - * - * @param closure rename closure - * @return this - */ - CopyProcessingSpec rename(Closure closure); - /** * Renames a source file. The function will be called with a single parameter, the name of the file. * The function should return a new target name. The function may return null, @@ -132,13 +120,4 @@ public interface CopyProcessingSpec extends ContentFilterable { */ CopyProcessingSpec eachFile(Action action); - /** - * Adds an action to be applied to each file as it about to be copied into its destination. The given closure is - * called with a {@link org.gradle.api.file.FileCopyDetails} as its parameter. Actions are executed in the order - * added, and are inherited from the parent spec. - * - * @param closure The action to execute. - * @return this - */ - CopyProcessingSpec eachFile(@DelegatesTo(value=FileCopyDetails.class, strategy = Closure.DELEGATE_FIRST) Closure closure); } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySourceSpec.java b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySourceSpec.java index 25ecbf1c1148e..14ff143b60d08 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySourceSpec.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySourceSpec.java @@ -15,8 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; /** @@ -31,15 +29,6 @@ public interface CopySourceSpec { */ CopySourceSpec from(Object... sourcePaths); - /** - * Specifies the source files or directories for a copy and creates a child {@code CopySourceSpec}. The given source - * path is evaluated as per {@link org.gradle.api.Project#files(Object...)} . - * - * @param sourcePath Path to source for the copy - * @param configureClosure closure for configuring the child CopySourceSpec - */ - CopySourceSpec from(Object sourcePath, @DelegatesTo(CopySpec.class) Closure configureClosure); - /** * Specifies the source files or directories for a copy and creates a child {@code CopySpec}. The given source * path is evaluated as per {@link org.gradle.api.Project#files(Object...)} . diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java index 66ff88e5353eb..1d5921765aff3 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/CopySpec.java @@ -15,8 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Transformer; import org.gradle.api.specs.Spec; @@ -204,12 +202,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec from(Object... sourcePaths); - /** - * {@inheritDoc} - */ - @Override - CopySpec from(Object sourcePath, @DelegatesTo(CopySpec.class) Closure c); - /** * {@inheritDoc} */ @@ -258,14 +250,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec include(Spec includeSpec); - /** - * {@inheritDoc} - * - * @see org.gradle.api.tasks.util.PatternFilterable Pattern Format - */ - @Override - CopySpec include(Closure includeSpec); - /** * {@inheritDoc} * @@ -290,14 +274,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec exclude(Spec excludeSpec); - /** - * {@inheritDoc} - * - * @see org.gradle.api.tasks.util.PatternFilterable Pattern Format - */ - @Override - CopySpec exclude(Closure excludeSpec); - // CopyProcessingSpec overrides to broaden return type /** @@ -306,16 +282,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec into(Object destPath); - /** - * Creates and configures a child {@code CopySpec} with the given destination path. - * The destination is evaluated as per {@link org.gradle.api.Project#file(Object)}. - * - * @param destPath Path to the destination directory for a Copy - * @param configureClosure The closure to use to configure the child {@code CopySpec}. - * @return this - */ - CopySpec into(Object destPath, @DelegatesTo(CopySpec.class) Closure configureClosure); - /** * Creates and configures a child {@code CopySpec} with the given destination path. * The destination is evaluated as per {@link org.gradle.api.Project#file(Object)}. @@ -326,12 +292,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil */ CopySpec into(Object destPath, Action copySpec); - /** - * {@inheritDoc} - */ - @Override - CopySpec rename(Closure closure); - /** * {@inheritDoc} */ @@ -362,12 +322,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec filter(Class filterType); - /** - * {@inheritDoc} - */ - @Override - CopySpec filter(Closure closure); - /** * {@inheritDoc} */ @@ -392,12 +346,6 @@ public interface CopySpec extends CopySourceSpec, CopyProcessingSpec, PatternFil @Override CopySpec eachFile(Action action); - /** - * {@inheritDoc} - */ - @Override - CopySpec eachFile(@DelegatesTo(FileCopyDetails.class) Closure closure); - /** * Gets the charset used to read and write files when filtering. * By default, the JVM default charset is used. diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/FileCollection.java b/subprojects/core-api/src/main/java/org/gradle/api/file/FileCollection.java index 53b104ae28233..405fae337266e 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/FileCollection.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/FileCollection.java @@ -15,7 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; import org.gradle.api.Buildable; import org.gradle.api.provider.Provider; import org.gradle.api.specs.Spec; @@ -98,18 +97,6 @@ public interface FileCollection extends Iterable, AntBuilderAware, Buildab */ FileCollection minus(FileCollection collection); - /** - *

      Restricts the contents of this collection to those files which match the given criteria. The filtered - * collection is live, so that it reflects any changes to this collection.

      - * - *

      The given closure is passed the @{link File} as a parameter, and should return a boolean value. The closure should return {@code true} - * to include the file in the result and {@code false} to exclude the file from the result.

      - * - * @param filterClosure The closure to use to select the contents of the filtered collection. - * @return The filtered collection. - */ - FileCollection filter(Closure filterClosure); - /** *

      Restricts the contents of this collection to those files which match the given criteria. The filtered * collection is live, so that it reflects any changes to this collection.

      diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/FileTree.java b/subprojects/core-api/src/main/java/org/gradle/api/file/FileTree.java index 8b4af2b5c5cff..0d6d048447f9b 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/FileTree.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/FileTree.java @@ -15,8 +15,6 @@ */ package org.gradle.api.file; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.tasks.util.PatternFilterable; import org.gradle.internal.HasInternalProtocol; @@ -37,19 +35,6 @@ */ @HasInternalProtocol public interface FileTree extends FileCollection { - /** - *

      Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so - * that any changes to this tree are reflected in the filtered tree.

      - * - *

      The given closure is used to configure the filter. A {@link org.gradle.api.tasks.util.PatternFilterable} is - * passed to the closure as its delegate. Only files which match the specified include patterns will be included in - * the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered - * tree.

      - * - * @param filterConfigClosure the closure to use to configure the filter. - * @return The filtered tree. - */ - FileTree matching(@DelegatesTo(PatternFilterable.class) Closure filterConfigClosure); /** *

      Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so @@ -88,16 +73,6 @@ public interface FileTree extends FileCollection { */ FileTree visit(FileVisitor visitor); - /** - * Visits the files and directories in this file tree. Files are visited in depth-first prefix order, so that a directory - * is visited before its children. The file/directory to be visited is passed to the given closure as a {@link - * FileVisitDetails} - * - * @param visitor The visitor. - * @return this - */ - FileTree visit(@DelegatesTo(FileVisitDetails.class) Closure visitor); - /** * Visits the files and directories in this file tree. Files are visited in depth-first prefix order, so that a directory * is visited before its children. The file/directory to be visited is passed to the given action as a {@link diff --git a/subprojects/core-api/src/main/java/org/gradle/api/file/FileVisitDetails.java b/subprojects/core-api/src/main/java/org/gradle/api/file/FileVisitDetails.java index cfc6fea9797c1..d4267205632d3 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/file/FileVisitDetails.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/file/FileVisitDetails.java @@ -18,7 +18,7 @@ /** * Provides access to details about a file or directory being visited by a {@link FileVisitor}. * - * @see FileTree#visit(groovy.lang.Closure) + * @see FileTree#visit(org.gradle.api.Action) */ public interface FileVisitDetails extends FileTreeElement { diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternFilterable.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternFilterable.java index 338ac133938ec..f10af3c78b28d 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternFilterable.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternFilterable.java @@ -15,7 +15,6 @@ */ package org.gradle.api.tasks.util; -import groovy.lang.Closure; import org.gradle.api.file.FileTreeElement; import org.gradle.api.specs.Spec; @@ -138,19 +137,6 @@ public interface PatternFilterable { */ PatternFilterable include(Spec includeSpec); - /** - * Adds an include spec. This method may be called multiple times to append new specs. The given closure is passed a - * {@link org.gradle.api.file.FileTreeElement} as its parameter. - * - * If includes are not provided, then all files in this container will be included. If includes are provided, then a - * file must match at least one of the include patterns or specs to be included. - * - * @param includeSpec the spec to add - * @return this - * @see PatternFilterable Pattern Format - */ - PatternFilterable include(Closure includeSpec); - /** * Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple * patterns may be specified in a single call. @@ -189,25 +175,4 @@ public interface PatternFilterable { */ PatternFilterable exclude(Spec excludeSpec); - /** - * Adds an exclude spec. This method may be called multiple times to append new specs.The given closure is passed a - * {@link org.gradle.api.file.FileTreeElement} as its parameter. The closure should return true or false. Example: - * - *

      -     * copySpec {
      -     *   from 'source'
      -     *   into 'destination'
      -     *   //an example of excluding files from certain configuration:
      -     *   exclude { it.file in configurations.someConf.files }
      -     * }
      -     * 
      - * - * If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match - * any exclude pattern to be processed. - * - * @param excludeSpec the spec to add - * @return this - * @see FileTreeElement - */ - PatternFilterable exclude(Closure excludeSpec); } diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternSet.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternSet.java index 8cde5c5a3f961..8fc3c4f66d74f 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternSet.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/util/PatternSet.java @@ -17,10 +17,8 @@ package org.gradle.api.tasks.util; import com.google.common.collect.Sets; -import groovy.lang.Closure; import org.gradle.api.file.FileTreeElement; import org.gradle.api.specs.Spec; -import org.gradle.api.specs.Specs; import org.gradle.api.tasks.AntBuilderAware; import org.gradle.api.tasks.util.internal.IntersectionPatternSet; import org.gradle.api.tasks.util.internal.PatternSetAntBuilderDelegate; @@ -252,12 +250,6 @@ public PatternSet includeSpecs(Iterable> includeSpecs) { return this; } - @Override - public PatternSet include(Closure closure) { - include(Specs.convertClosureToSpec(closure)); - return this; - } - @Override public PatternSet exclude(String... excludes) { Collections.addAll(getExcludes(), excludes); @@ -283,12 +275,6 @@ public PatternSet excludeSpecs(Iterable> excludes) { return this; } - @Override - public PatternSet exclude(Closure closure) { - exclude(Specs.convertClosureToSpec(closure)); - return this; - } - @Override public Object addToAntBuilder(Object node, String childNodeName) { diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/DefaultSourceDirectorySet.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/DefaultSourceDirectorySet.java index 6d8cdbe1cbdae..03f18a6071e64 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/DefaultSourceDirectorySet.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/DefaultSourceDirectorySet.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal.file; -import groovy.lang.Closure; import org.gradle.api.Buildable; import org.gradle.api.InvalidUserDataException; import org.gradle.api.Task; @@ -156,12 +155,6 @@ public PatternFilterable include(Spec includeSpec) { return this; } - @Override - public PatternFilterable include(Closure includeSpec) { - patterns.include(includeSpec); - return this; - } - @Override public PatternFilterable exclude(Iterable excludes) { patterns.exclude(excludes); @@ -179,13 +172,6 @@ public PatternFilterable exclude(Spec excludeSpec) { patterns.exclude(excludeSpec); return this; } - - @Override - public PatternFilterable exclude(Closure excludeSpec) { - patterns.exclude(excludeSpec); - return this; - } - @Override public PatternFilterable getFilter() { return filter; diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/CopySpecWrapper.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/CopySpecWrapper.java index 6a94e27c598f5..ba3d98c4edd73 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/CopySpecWrapper.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/CopySpecWrapper.java @@ -17,7 +17,6 @@ package org.gradle.api.internal.file.copy; import com.google.common.annotations.VisibleForTesting; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.NonExtensible; import org.gradle.api.Transformer; @@ -30,7 +29,6 @@ import org.gradle.api.file.SyncSpec; import org.gradle.api.specs.Spec; import org.gradle.api.tasks.util.PatternFilterable; -import org.gradle.util.internal.ClosureBackedAction; import javax.annotation.Nullable; import javax.inject.Inject; @@ -39,8 +37,6 @@ import java.util.Set; import java.util.regex.Pattern; -import static org.gradle.api.internal.lambdas.SerializableLambdas.transformer; - /** * Wraps another CopySpec impl, only exposing the CopySpec API. * @@ -123,11 +119,6 @@ public CopySpec from(Object... sourcePaths) { return this; } - @Override - public CopySpec from(Object sourcePath, final Closure c) { - return delegate.from(sourcePath, new ClosureBackedAction<>(c)); - } - @Override public CopySpec from(Object sourcePath, Action configureAction) { return delegate.from(sourcePath, configureAction); @@ -163,12 +154,6 @@ public CopySpec include(Spec includeSpec) { return this; } - @Override - public CopySpec include(Closure includeSpec) { - delegate.include(includeSpec); - return this; - } - @Override public CopySpec exclude(String... excludes) { delegate.exclude(excludes); @@ -187,38 +172,17 @@ public CopySpec exclude(Spec excludeSpec) { return this; } - @Override - public CopySpec exclude(Closure excludeSpec) { - delegate.exclude(excludeSpec); - return this; - } - @Override public CopySpec into(Object destPath) { delegate.into(destPath); return this; } - @Override - public CopySpec into(Object destPath, Closure configureClosure) { - return delegate.into(destPath, configureClosure); - } - @Override public CopySpec into(Object destPath, Action copySpec) { return delegate.into(destPath, copySpec); } - @Override - public CopySpec rename(final Closure closure) { - delegate.rename(transformer(s -> { - Object res = closure.call(s); - //noinspection ConstantConditions - return res == null ? null : res.toString(); - })); - return this; - } - @Override public CopySpec rename(Transformer renamer) { delegate.rename(renamer); @@ -249,12 +213,6 @@ public CopySpec filter(Class filterType) { return this; } - @Override - public CopySpec filter(Closure closure) { - delegate.filter(closure); - return this; - } - @Override public CopySpec filter(Transformer transformer) { delegate.filter(transformer); @@ -279,12 +237,6 @@ public CopySpec eachFile(Action action) { return this; } - @Override - public CopySpec eachFile(Closure closure) { - delegate.eachFile(closure); - return this; - } - @Override public Integer getFileMode() { return delegate.getFileMode(); diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultCopySpec.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultCopySpec.java index 1fffe4ee4b660..bb134d1a82f28 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultCopySpec.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultCopySpec.java @@ -19,7 +19,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.InvalidUserDataException; import org.gradle.api.NonExtensible; @@ -46,8 +45,6 @@ import org.gradle.internal.Factory; import org.gradle.internal.reflect.Instantiator; import org.gradle.internal.typeconversion.NotationParser; -import org.gradle.util.internal.ClosureBackedAction; -import org.gradle.util.internal.ConfigureUtil; import javax.annotation.Nullable; import javax.inject.Inject; @@ -145,11 +142,6 @@ public CopySpec from(Object... sourcePaths) { return this; } - @Override - public CopySpec from(Object sourcePath, Closure c) { - return from(sourcePath, new ClosureBackedAction<>(c)); - } - @Override public CopySpec from(Object sourcePath, Action configureAction) { Preconditions.checkNotNull(configureAction, "Gradle does not allow passing null for the configuration action for CopySpec.from()."); @@ -243,11 +235,6 @@ public CopySpec into(Object destDir) { return this; } - @Override - public CopySpec into(Object destPath, Closure configureClosure) { - return into(destPath, new ClosureBackedAction<>(configureClosure)); - } - @Override public CopySpec into(Object destPath, Action copySpec) { Preconditions.checkNotNull(copySpec, "Gradle does not allow passing null for the configuration action for CopySpec.into()."); @@ -344,12 +331,6 @@ public CopySpec include(Spec includeSpec) { return this; } - @Override - public CopySpec include(Closure includeSpec) { - patternSet.include(includeSpec); - return this; - } - @Override public Set getIncludes() { return patternSet.getIncludes(); @@ -379,12 +360,6 @@ public CopySpec exclude(Spec excludeSpec) { return this; } - @Override - public CopySpec exclude(Closure excludeSpec) { - patternSet.exclude(excludeSpec); - return this; - } - @Override public Set getExcludes() { return patternSet.getExcludes(); @@ -414,11 +389,6 @@ public CopySpec filter(final Class filterType) { return this; } - @Override - public CopySpec filter(final Closure closure) { - return filter(new ClosureBackedTransformer(closure)); - } - @Override public CopySpec filter(final Transformer transformer) { appendCopyAction(new TransformerBackedFilterAction(transformer)); @@ -443,11 +413,6 @@ public CopySpec expand(final Map properties, final Action renamer) { appendCopyAction(new RenamingCopyAction(renamer)); @@ -503,12 +468,6 @@ public CopySpecInternal preserve(Action action) { return this; } - @Override - public CopySpec eachFile(Closure closure) { - appendCopyAction(ConfigureUtil.configureUsing(closure)); - return this; - } - @Override public Collection getChildren() { return childSpecs; diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultFileCopyDetails.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultFileCopyDetails.java index 9036be573b643..d0579b7b2ccc3 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultFileCopyDetails.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DefaultFileCopyDetails.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.file.copy; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Transformer; import org.gradle.api.file.ContentFilterable; @@ -196,11 +195,6 @@ public void setMode(int mode) { this.mode = mode; } - @Override - public ContentFilterable filter(Closure closure) { - return filter(new ClosureBackedTransformer(closure)); - } - @Override public ContentFilterable filter(Transformer transformer) { filterChain.add(transformer); diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DelegatingCopySpecInternal.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DelegatingCopySpecInternal.java index 92dcda1135ded..abedfb623c99c 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DelegatingCopySpecInternal.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/DelegatingCopySpecInternal.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.file.copy; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Transformer; import org.gradle.api.file.CopyProcessingSpec; @@ -27,7 +26,6 @@ import org.gradle.api.file.FileTreeElement; import org.gradle.api.specs.Spec; import org.gradle.api.tasks.util.PatternFilterable; -import org.gradle.util.internal.ClosureBackedAction; import javax.annotation.Nullable; import java.io.FilterReader; @@ -99,11 +97,6 @@ public CopySpec from(Object... sourcePaths) { return getDelegateCopySpec().from(sourcePaths); } - @Override - public CopySpec from(Object sourcePath, final Closure c) { - return getDelegateCopySpec().from(sourcePath, new ClosureBackedAction<>(c)); - } - @Override public CopySpec from(Object sourcePath, Action configureAction) { return getDelegateCopySpec().from(sourcePath, configureAction); @@ -134,11 +127,6 @@ public CopySpec include(Spec includeSpec) { return getDelegateCopySpec().include(includeSpec); } - @Override - public CopySpec include(Closure includeSpec) { - return getDelegateCopySpec().include(includeSpec); - } - @Override public CopySpec exclude(String... excludes) { return getDelegateCopySpec().exclude(excludes); @@ -154,31 +142,16 @@ public CopySpec exclude(Spec excludeSpec) { return getDelegateCopySpec().exclude(excludeSpec); } - @Override - public CopySpec exclude(Closure excludeSpec) { - return getDelegateCopySpec().exclude(excludeSpec); - } - @Override public CopySpec into(Object destPath) { return getDelegateCopySpec().into(destPath); } - @Override - public CopySpec into(Object destPath, Closure configureClosure) { - return getDelegateCopySpec().into(destPath, configureClosure); - } - @Override public CopySpec into(Object destPath, Action copySpec) { return getDelegateCopySpec().into(destPath, copySpec); } - @Override - public CopySpec rename(Closure closure) { - return getDelegateCopySpec().rename(closure); - } - @Override public CopySpec rename(Transformer renamer) { return getDelegateCopySpec().rename(renamer); @@ -204,11 +177,6 @@ public CopySpec filter(Class filterType) { return getDelegateCopySpec().filter(filterType); } - @Override - public CopySpec filter(Closure closure) { - return getDelegateCopySpec().filter(closure); - } - @Override public CopySpec filter(Transformer transformer) { return getDelegateCopySpec().filter(transformer); @@ -229,11 +197,6 @@ public CopySpec eachFile(Action action) { return getDelegateCopySpec().eachFile(action); } - @Override - public CopySpec eachFile(Closure closure) { - return getDelegateCopySpec().eachFile(closure); - } - @Override public Integer getFileMode() { return getDelegateCopySpec().getFileMode(); diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/NormalizingCopyActionDecorator.java b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/NormalizingCopyActionDecorator.java index f55835cfbaf80..66e127a8a5915 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/NormalizingCopyActionDecorator.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/file/copy/NormalizingCopyActionDecorator.java @@ -17,7 +17,6 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Transformer; import org.gradle.api.file.ContentFilterable; @@ -218,11 +217,6 @@ public ContentFilterable filter(Class filterType) { throw new UnsupportedOperationException(); } - @Override - public ContentFilterable filter(Closure closure) { - throw new UnsupportedOperationException(); - } - @Override public ContentFilterable filter(Transformer transformer) { throw new UnsupportedOperationException(); diff --git a/subprojects/core/src/main/java/org/gradle/api/tasks/AbstractCopyTask.java b/subprojects/core/src/main/java/org/gradle/api/tasks/AbstractCopyTask.java index fbcc3a7e14ec8..d2f603762f84f 100644 --- a/subprojects/core/src/main/java/org/gradle/api/tasks/AbstractCopyTask.java +++ b/subprojects/core/src/main/java/org/gradle/api/tasks/AbstractCopyTask.java @@ -15,7 +15,6 @@ */ package org.gradle.api.tasks; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.GradleException; import org.gradle.api.NonNullApi; @@ -32,7 +31,6 @@ import org.gradle.api.internal.file.FileLookup; import org.gradle.api.internal.file.FileResolver; import org.gradle.api.internal.file.collections.DirectoryFileTreeFactory; -import org.gradle.api.internal.file.copy.ClosureBackedTransformer; import org.gradle.api.internal.file.copy.CopyAction; import org.gradle.api.internal.file.copy.CopyActionExecuter; import org.gradle.api.internal.file.copy.CopySpecInternal; @@ -43,7 +41,6 @@ import org.gradle.api.specs.Spec; import org.gradle.internal.nativeintegration.filesystem.FileSystem; import org.gradle.internal.reflect.Instantiator; -import org.gradle.util.internal.ClosureBackedAction; import org.gradle.work.DisableCachingByDefault; import javax.annotation.Nullable; @@ -278,15 +275,6 @@ public AbstractCopyTask filesNotMatching(Iterable patterns, Action(c)); - return this; - } - /** * {@inheritDoc} */ @@ -314,15 +302,6 @@ public AbstractCopyTask into(Object destDir) { return this; } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask into(Object destPath, Closure configureClosure) { - getMainSpec().into(destPath, configureClosure); - return this; - } - /** * {@inheritDoc} */ @@ -359,15 +338,6 @@ public AbstractCopyTask include(Spec includeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask include(Closure includeSpec) { - getMainSpec().include(includeSpec); - return this; - } - /** * {@inheritDoc} */ @@ -395,15 +365,6 @@ public AbstractCopyTask exclude(Spec excludeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask exclude(Closure excludeSpec) { - getMainSpec().exclude(excludeSpec); - return this; - } - /** * {@inheritDoc} */ @@ -440,14 +401,6 @@ public Set getExcludes() { return getMainSpec().getExcludes(); } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask rename(Closure closure) { - return rename(new ClosureBackedTransformer(closure)); - } - /** * {@inheritDoc} */ @@ -493,15 +446,6 @@ public AbstractCopyTask filter(Class filterType) { return this; } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask filter(Closure closure) { - getMainSpec().filter(closure); - return this; - } - /** * {@inheritDoc} */ @@ -574,15 +518,6 @@ public AbstractCopyTask eachFile(Action action) { return this; } - /** - * {@inheritDoc} - */ - @Override - public AbstractCopyTask eachFile(Closure closure) { - getMainSpec().eachFile(closure); - return this; - } - /** * {@inheritDoc} */ diff --git a/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java b/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java index 42b5060cd4087..cf3f82bb9de53 100644 --- a/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java +++ b/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java @@ -16,7 +16,6 @@ package org.gradle.api.tasks; -import groovy.lang.Closure; import org.gradle.api.NonNullApi; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.FileTree; @@ -129,15 +128,6 @@ public SourceTask include(Spec includeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public SourceTask include(Closure includeSpec) { - patternSet.include(includeSpec); - return this; - } - /** * {@inheritDoc} */ @@ -165,15 +155,6 @@ public SourceTask exclude(Spec excludeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public SourceTask exclude(Closure excludeSpec) { - patternSet.exclude(excludeSpec); - return this; - } - /** * {@inheritDoc} */ diff --git a/subprojects/core/src/main/java/org/gradle/api/tasks/bundling/AbstractArchiveTask.java b/subprojects/core/src/main/java/org/gradle/api/tasks/bundling/AbstractArchiveTask.java index b8a9d57bf5803..e49a3611ad2b5 100644 --- a/subprojects/core/src/main/java/org/gradle/api/tasks/bundling/AbstractArchiveTask.java +++ b/subprojects/core/src/main/java/org/gradle/api/tasks/bundling/AbstractArchiveTask.java @@ -15,7 +15,6 @@ */ package org.gradle.api.tasks.bundling; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.file.CopySpec; import org.gradle.api.file.DirectoryProperty; @@ -466,21 +465,6 @@ public AbstractArchiveTask into(Object destPath) { return this; } - /** - * Creates and configures a child {@code CopySpec} with a destination directory *inside* the archive for the files. - * The destination is evaluated as per {@link org.gradle.api.Project#file(Object)}. - * Don't mix it up with {@link #getDestinationDirectory()} which specifies the output directory for the archive. - * - * @param destPath destination directory *inside* the archive for the files - * @param configureClosure The closure to use to configure the child {@code CopySpec}. - * @return this - */ - @Override - public AbstractArchiveTask into(Object destPath, Closure configureClosure) { - super.into(destPath, configureClosure); - return this; - } - /** * Creates and configures a child {@code CopySpec} with a destination directory *inside* the archive for the files. diff --git a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileCollection.java b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileCollection.java index 608dae660e4af..3200381726eb2 100644 --- a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileCollection.java +++ b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileCollection.java @@ -16,7 +16,6 @@ package org.gradle.api.internal.file; import com.google.common.collect.ImmutableSet; -import groovy.lang.Closure; import org.gradle.api.file.DirectoryTree; import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileSystemLocation; @@ -30,7 +29,6 @@ import org.gradle.api.internal.tasks.TaskDependencyResolveContext; import org.gradle.api.provider.Provider; import org.gradle.api.specs.Spec; -import org.gradle.api.specs.Specs; import org.gradle.api.tasks.TaskDependency; import org.gradle.api.tasks.util.PatternSet; import org.gradle.api.tasks.util.internal.PatternSets; @@ -346,11 +344,6 @@ public FileTreeInternal getAsFileTree() { return new FileCollectionBackedFileTree(patternSetFactory, this); } - @Override - public FileCollection filter(Closure filterClosure) { - return filter(Specs.convertClosureToSpec(filterClosure)); - } - @Override public FileCollectionInternal filter(final Spec filterSpec) { return new FilteredFileCollection(this, filterSpec); diff --git a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileTree.java b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileTree.java index d4ac7e1f8629c..c078139cb4b7c 100644 --- a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileTree.java +++ b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/AbstractFileTree.java @@ -15,8 +15,6 @@ */ package org.gradle.api.internal.file; -import groovy.lang.Closure; -import org.codehaus.groovy.runtime.DefaultGroovyMethods; import org.gradle.api.Action; import org.gradle.api.file.EmptyFileVisitor; import org.gradle.api.file.FileTree; @@ -34,8 +32,6 @@ import java.util.Map; import java.util.Set; -import static org.gradle.util.internal.ConfigureUtil.configure; - public abstract class AbstractFileTree extends AbstractFileCollection implements FileTreeInternal { public AbstractFileTree() { super(); @@ -70,11 +66,6 @@ public void visitFile(FileVisitDetails fileDetails) { return !found.get(); } - @Override - public FileTree matching(Closure filterConfigClosure) { - return matching(configure(filterConfigClosure, patternSetFactory.create())); - } - @Override public FileTree matching(Action filterConfigAction) { PatternSet patternSet = patternSetFactory.create(); @@ -108,15 +99,6 @@ public FileTree plus(FileTree fileTree) { return new UnionFileTree(this, Cast.cast(FileTreeInternal.class, fileTree)); } - @Override - public FileTree visit(Closure closure) { - return visit(fileVisitorFrom(closure)); - } - - static FileVisitor fileVisitorFrom(Closure closure) { - return DefaultGroovyMethods.asType(closure, FileVisitor.class); - } - @Override public FileTree visit(final Action visitor) { return visit(new FileVisitor() { diff --git a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/CompositeFileTree.java b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/CompositeFileTree.java index f498acbd55f62..38833403a6c64 100644 --- a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/CompositeFileTree.java +++ b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/CompositeFileTree.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal.file; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.file.FileTree; import org.gradle.api.file.FileVisitDetails; @@ -28,9 +27,6 @@ import java.util.List; import java.util.function.Consumer; -import static org.gradle.api.internal.file.AbstractFileTree.fileVisitorFrom; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * A {@link FileTree} that contains the union of zero or more file trees. */ @@ -53,14 +49,6 @@ public FileTree plus(FileTree fileTree) { return new UnionFileTree(this, Cast.cast(FileTreeInternal.class, fileTree)); } - @Override - public FileTree matching(final Closure filterConfigClosure) { - return new FilteredFileTree(this, patternSetFactory, () -> { - // For backwards compatibility, run the closure each time the file tree contents are queried - return configure(filterConfigClosure, patternSetFactory.create()); - }); - } - @Override public FileTree matching(final Action filterConfigAction) { return new FilteredFileTree(this, patternSetFactory, () -> { @@ -83,11 +71,6 @@ public FileTreeInternal matching(final PatternFilterable patterns) { }); } - @Override - public FileTree visit(Closure visitor) { - return visit(fileVisitorFrom(visitor)); - } - @Override public FileTree visit(Action visitor) { for (FileTree tree : getSourceCollections()) { diff --git a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/DefaultFileCollectionFactory.java b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/DefaultFileCollectionFactory.java index 5811bb1ea0f6a..a6d92f93e31e9 100644 --- a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/DefaultFileCollectionFactory.java +++ b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/DefaultFileCollectionFactory.java @@ -18,7 +18,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.ConfigurableFileTree; @@ -258,11 +257,6 @@ public boolean isEmpty() { return true; } - @Override - public FileTree matching(Closure filterConfigClosure) { - return this; - } - @Override public FileTree matching(Action filterConfigAction) { return this; diff --git a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/collections/DefaultConfigurableFileTree.java b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/collections/DefaultConfigurableFileTree.java index e5a2d8038f1ac..3ba97963421b3 100644 --- a/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/collections/DefaultConfigurableFileTree.java +++ b/subprojects/file-collections/src/main/java/org/gradle/api/internal/file/collections/DefaultConfigurableFileTree.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal.file.collections; -import groovy.lang.Closure; import org.gradle.api.InvalidUserDataException; import org.gradle.api.file.ConfigurableFileTree; import org.gradle.api.file.FileTreeElement; @@ -111,12 +110,6 @@ public DefaultConfigurableFileTree include(Iterable includes) { return this; } - @Override - public DefaultConfigurableFileTree include(Closure includeSpec) { - patternSet.include(includeSpec); - return this; - } - @Override public DefaultConfigurableFileTree include(Spec includeSpec) { patternSet.include(includeSpec); @@ -141,12 +134,6 @@ public DefaultConfigurableFileTree exclude(Spec excludeSpec) { return this; } - @Override - public DefaultConfigurableFileTree exclude(Closure excludeSpec) { - patternSet.exclude(excludeSpec); - return this; - } - @Override protected void visitChildren(Consumer visitor) { File dir = getDir(); diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java index 2f6d2c5aea992..918a7f4f07656 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java @@ -756,15 +756,6 @@ public Test include(Spec includeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public Test include(Closure includeSpec) { - patternSet.include(includeSpec); - return this; - } - /** * Adds exclude patterns for the files in the test classes directory (e.g. '**/*Test.class')). * @@ -796,15 +787,6 @@ public Test exclude(Spec excludeSpec) { return this; } - /** - * {@inheritDoc} - */ - @Override - public Test exclude(Closure excludeSpec) { - patternSet.exclude(excludeSpec); - return this; - } - /** * {@inheritDoc} */ From 75d472fbc0feb7c192700f8d20c80f95f627fd6c Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:48:05 -0400 Subject: [PATCH 22/40] Remove Closure taking methods from Gradle --- ...rossProjectConfigurationReportingGradle.kt | 30 ------- .../org/gradle/api/invocation/Gradle.java | 84 ----------------- .../org/gradle/invocation/DefaultGradle.java | 43 --------- .../invocation/DefaultGradleSpec.groovy | 90 ------------------- .../dsl/support/delegates/GradleDelegate.kt | 23 ----- 5 files changed, 270 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt index ebac00b9417da..e4382dc88eec5 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/CrossProjectConfigurationReportingGradle.kt @@ -16,7 +16,6 @@ package org.gradle.configurationcache -import groovy.lang.Closure import org.gradle.BuildListener import org.gradle.BuildResult import org.gradle.api.Action @@ -93,24 +92,13 @@ class CrossProjectConfigurationReportingGradle private constructor( delegate.removeProjectEvaluationListener(CrossProjectModelAccessProjectEvaluationListener(listener, referrerProject, crossProjectModelAccess)) } - override fun projectsEvaluated(closure: Closure<*>) = - delegate.projectsEvaluated(closure.withCrossProjectModelAccessChecks()) - override fun projectsEvaluated(action: Action) = delegate.projectsEvaluated(action.withCrossProjectModelGradleAccessCheck()) - override fun beforeProject(closure: Closure<*>) { - delegate.beforeProject(closure.withCrossProjectModelAccessChecks()) - } - override fun beforeProject(action: Action) { delegate.beforeProject(action.withCrossProjectModelAccessCheck()) } - override fun afterProject(closure: Closure<*>) { - delegate.afterProject(closure.withCrossProjectModelAccessChecks()) - } - override fun afterProject(action: Action) { delegate.afterProject(action.withCrossProjectModelAccessCheck()) } @@ -152,10 +140,6 @@ class CrossProjectConfigurationReportingGradle private constructor( else -> listener } - private - fun Closure.withCrossProjectModelAccessChecks(): Closure = - CrossProjectModelAccessTrackingClosure(this, referrerProject, crossProjectModelAccess) - private fun Action.withCrossProjectModelAccessCheck(): Action { val originalAction = this@withCrossProjectModelAccessCheck @@ -228,29 +212,15 @@ class CrossProjectConfigurationReportingGradle private constructor( override fun getStartParameter(): StartParameterInternal = delegate.startParameter - override fun beforeSettings(closure: Closure<*>) = - delegate.beforeSettings(closure) - override fun beforeSettings(action: Action) = delegate.beforeSettings(action) - override fun settingsEvaluated(closure: Closure<*>) = - delegate.settingsEvaluated(closure) - override fun settingsEvaluated(action: Action) = delegate.settingsEvaluated(action) - override fun projectsLoaded(closure: Closure<*>) = - delegate.projectsLoaded(closure) - override fun projectsLoaded(action: Action) = delegate.projectsLoaded(action) - @Suppress("OVERRIDE_DEPRECATION", "DEPRECATION") - override fun buildFinished(closure: Closure<*>) = - // already reported as configuration cache problem, no need to override - delegate.buildFinished(closure) - @Suppress("OVERRIDE_DEPRECATION", "DEPRECATION") override fun buildFinished(action: Action) = // already reported as configuration cache problem, no need to override diff --git a/subprojects/core-api/src/main/java/org/gradle/api/invocation/Gradle.java b/subprojects/core-api/src/main/java/org/gradle/api/invocation/Gradle.java index ff34d4359b7ea..4801b60a8e80b 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/invocation/Gradle.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/invocation/Gradle.java @@ -15,8 +15,6 @@ */ package org.gradle.api.invocation; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.BuildListener; import org.gradle.BuildResult; import org.gradle.StartParameter; @@ -139,14 +137,6 @@ public interface Gradle extends PluginAware { */ void removeProjectEvaluationListener(ProjectEvaluationListener listener); - /** - * Adds a closure to be called immediately before a project is evaluated. The project is passed to the closure as a - * parameter. - * - * @param closure The closure to execute. - */ - void beforeProject(Closure closure); - /** * Adds an action to be called immediately before a project is evaluated. * @@ -155,16 +145,6 @@ public interface Gradle extends PluginAware { */ void beforeProject(Action action); - /** - * Adds a closure to be called immediately after a project is evaluated. - * - * The project is passed to the closure as the first parameter. The project evaluation failure, if any, - * is passed as the second parameter. Both parameters are optional. - * - * @param closure The closure to execute. - */ - void afterProject(Closure closure); - /** * Adds an action to be called immediately after a project is evaluated. * @@ -173,14 +153,6 @@ public interface Gradle extends PluginAware { */ void afterProject(Action action); - /** - * Adds an action to be called before the build settings have been loaded and evaluated. - * - * @param closure The action to execute. - * @since 6.0 - */ - void beforeSettings(@DelegatesTo(Settings.class) Closure closure); - /** * Adds an action to be called before the build settings have been loaded and evaluated. * @@ -189,16 +161,6 @@ public interface Gradle extends PluginAware { */ void beforeSettings(Action action); - /** - * Adds a closure to be called when the build settings have been loaded and evaluated. - * - * The settings object is fully configured and is ready to use to load the build projects. The - * {@link org.gradle.api.initialization.Settings} object is passed to the closure as a parameter. - * - * @param closure The closure to execute. - */ - void settingsEvaluated(Closure closure); - /** * Adds an action to be called when the build settings have been loaded and evaluated. * @@ -209,30 +171,6 @@ public interface Gradle extends PluginAware { */ void settingsEvaluated(Action action); - /** - * Adds a closure to be called when the projects for the build have been created from the settings. - * - * None of the projects have been evaluated. This {@code Gradle} instance is passed to the closure as a parameter. - *

      - * An example of hooking into the projectsLoaded to configure buildscript classpath from the init script. - *

      -     * //init.gradle
      -     * gradle.projectsLoaded {
      -     *   rootProject.buildscript {
      -     *     repositories {
      -     *       //...
      -     *     }
      -     *     dependencies {
      -     *       //...
      -     *     }
      -     *   }
      -     * }
      -     * 
      - * - * @param closure The closure to execute. - */ - void projectsLoaded(Closure closure); - /** * Adds an action to be called when the projects for the build have been created from the settings. * @@ -243,16 +181,6 @@ public interface Gradle extends PluginAware { */ void projectsLoaded(Action action); - /** - * Adds a closure to be called when all projects for the build have been evaluated. - * - * The project objects are fully configured and are ready to use to populate the task graph. - * This {@code Gradle} instance is passed to the closure as a parameter. - * - * @param closure The closure to execute. - */ - void projectsEvaluated(Closure closure); - /** * Adds an action to be called when all projects for the build have been evaluated. * @@ -263,18 +191,6 @@ public interface Gradle extends PluginAware { */ void projectsEvaluated(Action action); - /** - * Adds a closure to be called when the build is completed. - * - * All selected tasks have been executed. - * A {@link BuildResult} instance is passed to the closure as a parameter. - * - * @param closure The closure to execute. - * @deprecated This method is not supported when configuration caching is enabled. - */ - @Deprecated - void buildFinished(Closure closure); - /** * Adds an action to be called when the build is completed. * diff --git a/subprojects/core/src/main/java/org/gradle/invocation/DefaultGradle.java b/subprojects/core/src/main/java/org/gradle/invocation/DefaultGradle.java index 0499ea68e0f7a..466cc7369a919 100644 --- a/subprojects/core/src/main/java/org/gradle/invocation/DefaultGradle.java +++ b/subprojects/core/src/main/java/org/gradle/invocation/DefaultGradle.java @@ -17,7 +17,6 @@ package org.gradle.invocation; import com.google.common.collect.ImmutableList; -import groovy.lang.Closure; import org.gradle.BuildListener; import org.gradle.BuildResult; import org.gradle.StartParameter; @@ -62,7 +61,6 @@ import org.gradle.internal.resource.TextUriResourceLoader; import org.gradle.internal.service.ServiceRegistry; import org.gradle.internal.service.scopes.ServiceRegistryFactory; -import org.gradle.listener.ClosureBackedMethodInvocationDispatch; import org.gradle.util.GradleVersion; import org.gradle.util.Path; @@ -287,81 +285,40 @@ private void assertProjectMutatingMethodAllowed(String methodName) { MutationGuards.of(crossProjectConfigurator).assertMutationAllowed(methodName, this, Gradle.class); } - @Override - public void beforeProject(Closure closure) { - assertProjectMutatingMethodAllowed("beforeProject(Closure)"); - projectEvaluationListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("beforeEvaluate", getListenerBuildOperationDecorator().decorate("Gradle.beforeProject", Cast.>uncheckedNonnullCast(closure)))); - } - @Override public void beforeProject(Action action) { assertProjectMutatingMethodAllowed("beforeProject(Action)"); projectEvaluationListenerBroadcast.add("beforeEvaluate", getListenerBuildOperationDecorator().decorate("Gradle.beforeProject", action)); } - @Override - public void afterProject(Closure closure) { - assertProjectMutatingMethodAllowed("afterProject(Closure)"); - projectEvaluationListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("afterEvaluate", getListenerBuildOperationDecorator().decorate("Gradle.afterProject", Cast.>uncheckedNonnullCast(closure)))); - } - @Override public void afterProject(Action action) { assertProjectMutatingMethodAllowed("afterProject(Action)"); projectEvaluationListenerBroadcast.add("afterEvaluate", getListenerBuildOperationDecorator().decorate("Gradle.afterProject", action)); } - @Override - public void beforeSettings(Closure closure) { - buildListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("beforeSettings", closure)); - } - @Override public void beforeSettings(Action action) { buildListenerBroadcast.add("beforeSettings", action); } - @Override - public void settingsEvaluated(Closure closure) { - buildListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("settingsEvaluated", closure)); - } - @Override public void settingsEvaluated(Action action) { buildListenerBroadcast.add("settingsEvaluated", action); } - @Override - public void projectsLoaded(Closure closure) { - assertProjectMutatingMethodAllowed("projectsLoaded(Closure)"); - buildListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("projectsLoaded", getListenerBuildOperationDecorator().decorate("Gradle.projectsLoaded", Cast.>uncheckedNonnullCast(closure)))); - } - @Override public void projectsLoaded(Action action) { assertProjectMutatingMethodAllowed("projectsLoaded(Action)"); buildListenerBroadcast.add("projectsLoaded", getListenerBuildOperationDecorator().decorate("Gradle.projectsLoaded", action)); } - @Override - public void projectsEvaluated(Closure closure) { - assertProjectMutatingMethodAllowed("projectsEvaluated(Closure)"); - buildListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("projectsEvaluated", getListenerBuildOperationDecorator().decorate("Gradle.projectsEvaluated", Cast.>uncheckedNonnullCast(closure)))); - } - @Override public void projectsEvaluated(Action action) { assertProjectMutatingMethodAllowed("projectsEvaluated(Action)"); buildListenerBroadcast.add("projectsEvaluated", getListenerBuildOperationDecorator().decorate("Gradle.projectsEvaluated", action)); } - @SuppressWarnings("deprecation") - @Override - public void buildFinished(Closure closure) { - notifyListenerRegistration("Gradle.buildFinished", closure); - buildListenerBroadcast.add(new ClosureBackedMethodInvocationDispatch("buildFinished", closure)); - } - @SuppressWarnings("deprecation") @Override public void buildFinished(Action action) { diff --git a/subprojects/core/src/test/groovy/org/gradle/invocation/DefaultGradleSpec.groovy b/subprojects/core/src/test/groovy/org/gradle/invocation/DefaultGradleSpec.groovy index a47a12a8e3a59..bf30d8385403c 100644 --- a/subprojects/core/src/test/groovy/org/gradle/invocation/DefaultGradleSpec.groovy +++ b/subprojects/core/src/test/groovy/org/gradle/invocation/DefaultGradleSpec.groovy @@ -105,96 +105,6 @@ class DefaultGradleSpec extends Specification { gradle.gradleUserHomeDir == new File("user").canonicalFile } - def "broadcasts before project evaluate events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.beforeProject(closure) - - and: - gradle.projectEvaluationBroadcaster.beforeEvaluate(null) - - then: - called - } - - def "broadcasts after project evaluate events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.afterProject(closure) - - and: - gradle.projectEvaluationBroadcaster.afterEvaluate(null, null) - - then: - called - } - - def "broadcasts settings evaluated events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.settingsEvaluated(closure) - - and: - gradle.buildListenerBroadcaster.settingsEvaluated(null) - - then: - called - } - - def "broadcasts projects loaded events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.projectsLoaded(closure) - - and: - gradle.buildListenerBroadcaster.projectsLoaded(gradle) - - then: - called - } - - def "broadcasts projects evaluated events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.projectsEvaluated(closure) - - and: - gradle.buildListenerBroadcaster.projectsEvaluated(gradle) - - then: - called - } - - def "broadcasts build finished events to closures"() { - given: - def called = false - def closure = { called = true } - - when: - gradle.buildFinished(closure) - - and: - gradle.buildListenerBroadcaster.buildFinished(null) - - then: - called - } - def "broadcasts before project evaluate events to actions"() { given: def action = Mock(Action) diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt index a5bb682d57f44..1288617b08758 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/GradleDelegate.kt @@ -16,7 +16,6 @@ package org.gradle.kotlin.dsl.support.delegates -import groovy.lang.Closure import org.gradle.BuildListener import org.gradle.BuildResult import org.gradle.StartParameter @@ -74,46 +73,24 @@ abstract class GradleDelegate : Gradle { override fun removeProjectEvaluationListener(listener: ProjectEvaluationListener) = delegate.removeProjectEvaluationListener(listener) - override fun beforeSettings(closure: Closure<*>) = - delegate.beforeSettings(closure) - override fun beforeSettings(action: Action) = delegate.beforeSettings(action) - override fun beforeProject(closure: Closure) = - delegate.beforeProject(closure) - override fun beforeProject(action: Action) = delegate.beforeProject(action) - override fun afterProject(closure: Closure) = - delegate.afterProject(closure) - override fun afterProject(action: Action) = delegate.afterProject(action) - override fun settingsEvaluated(closure: Closure) = - delegate.settingsEvaluated(closure) - override fun settingsEvaluated(action: Action) = delegate.settingsEvaluated(action) - override fun projectsLoaded(closure: Closure) = - delegate.projectsLoaded(closure) - override fun projectsLoaded(action: Action) = delegate.projectsLoaded(action) - override fun projectsEvaluated(closure: Closure) = - delegate.projectsEvaluated(closure) - override fun projectsEvaluated(action: Action) = delegate.projectsEvaluated(action) - @Suppress("DEPRECATION") - override fun buildFinished(closure: Closure) = - delegate.buildFinished(closure) - @Suppress("DEPRECATION") override fun buildFinished(action: Action) = delegate.buildFinished(action) From f225fc32f3c161374d73acf9fb3e4cffb061bfe0 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:48:58 -0400 Subject: [PATCH 23/40] Remove Closure methods from PluginCollection --- .../java/org/gradle/api/plugins/PluginCollection.java | 10 ---------- .../api/internal/plugins/DefaultPluginCollection.java | 7 ------- 2 files changed, 17 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginCollection.java b/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginCollection.java index 403ae2c662dbf..055e6e8bdf139 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginCollection.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/plugins/PluginCollection.java @@ -15,7 +15,6 @@ */ package org.gradle.api.plugins; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.DomainObjectSet; import org.gradle.api.Plugin; @@ -50,15 +49,6 @@ public interface PluginCollection extends DomainObjectSet { @SuppressWarnings("UnusedDeclaration") Action whenPluginAdded(Action action); - /** - * Adds a closure to be called when a plugin is added to this collection. The plugin is passed to the closure as the - * parameter. - * - * @param closure The closure to be called - */ - @SuppressWarnings("UnusedDeclaration") - void whenPluginAdded(Closure closure); - /** * Unsupported. * @deprecated Use {@link PluginManager#apply(Class)} instead. diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java index 1d5389cbea734..ac96ce6ce1301 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/plugins/DefaultPluginCollection.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal.plugins; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.Plugin; import org.gradle.api.internal.CollectionCallbackActionDecorator; @@ -23,7 +22,6 @@ import org.gradle.api.internal.collections.CollectionFilter; import org.gradle.api.plugins.PluginCollection; import org.gradle.api.specs.Spec; -import org.gradle.util.internal.ConfigureUtil; import java.util.Collection; @@ -77,9 +75,4 @@ public Action whenPluginAdded(Action action) { return whenObjectAdded(action); } - @Override - public void whenPluginAdded(Closure closure) { - whenObjectAdded(ConfigureUtil.configureUsing(closure)); - } - } From 8ea3493a3096c11bf61f8b42a40ad31e504b6cd7 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:51:27 -0400 Subject: [PATCH 24/40] Remove Closure taking methods from TaskOutputs --- .../java/org/gradle/api/tasks/TaskOutputs.java | 18 ------------------ .../api/internal/tasks/DefaultTaskOutputs.java | 9 --------- 2 files changed, 27 deletions(-) diff --git a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskOutputs.java b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskOutputs.java index d8a37505d603d..7b39fd2767117 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskOutputs.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/tasks/TaskOutputs.java @@ -16,7 +16,6 @@ package org.gradle.api.tasks; -import groovy.lang.Closure; import org.gradle.api.Task; import org.gradle.api.file.FileCollection; import org.gradle.api.specs.Spec; @@ -29,23 +28,6 @@ */ @HasInternalProtocol public interface TaskOutputs { - /** - *

      - * Adds a predicate to determine whether previous outputs of this task can be reused. - * The given closure is executed at task execution time. - * The closure is passed the task as a parameter. - * If the closure returns false, previous outputs of this task cannot be reused and the task will be executed. - * That means the task is out-of-date and no outputs will be loaded from the build cache. - *

      - * - *

      - * You can add multiple such predicates. - * The task outputs cannot be reused when any predicate returns false. - *

      - * - * @param upToDateClosure The closure to use to determine whether the task outputs are up-to-date. - */ - void upToDateWhen(Closure upToDateClosure); /** *

      diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskOutputs.java b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskOutputs.java index 491973949fc9c..a106f396566b0 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskOutputs.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/tasks/DefaultTaskOutputs.java @@ -17,7 +17,6 @@ package org.gradle.api.internal.tasks; import com.google.common.collect.ImmutableSortedSet; -import groovy.lang.Closure; import org.gradle.api.Describable; import org.gradle.api.NonNullApi; import org.gradle.api.Task; @@ -80,14 +79,6 @@ public void visitRegisteredProperties(PropertyVisitor visitor) { public AndSpec getUpToDateSpec() { return upToDateSpec; } - - @Override - public void upToDateWhen(final Closure upToDateClosure) { - taskMutator.mutate("TaskOutputs.upToDateWhen(Closure)", () -> { - upToDateSpec = upToDateSpec.and(upToDateClosure); - }); - } - @Override public void upToDateWhen(final Spec spec) { taskMutator.mutate("TaskOutputs.upToDateWhen(Spec)", () -> { From 01bbac271d2a89a58e7ff6df62e59a824d5753b4 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:54:46 -0400 Subject: [PATCH 25/40] Remove Closure methods from ProjectConfigurationActionContainer --- ...ultProjectConfigurationActionContainer.java | 6 ------ .../ProjectConfigurationActionContainer.java | 6 ------ ...jectConfigurationActionContainerTest.groovy | 18 ------------------ 3 files changed, 30 deletions(-) diff --git a/subprojects/core/src/main/java/org/gradle/configuration/project/DefaultProjectConfigurationActionContainer.java b/subprojects/core/src/main/java/org/gradle/configuration/project/DefaultProjectConfigurationActionContainer.java index 74634712d5133..4bdd80eef5a33 100644 --- a/subprojects/core/src/main/java/org/gradle/configuration/project/DefaultProjectConfigurationActionContainer.java +++ b/subprojects/core/src/main/java/org/gradle/configuration/project/DefaultProjectConfigurationActionContainer.java @@ -16,10 +16,8 @@ package org.gradle.configuration.project; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.internal.project.ProjectInternal; -import org.gradle.util.internal.ConfigureUtil; import java.util.ArrayList; import java.util.List; @@ -42,8 +40,4 @@ public void add(Action action) { actions.add(action); } - @Override - public void add(Closure action) { - add(ConfigureUtil.configureUsing(action)); - } } diff --git a/subprojects/core/src/main/java/org/gradle/configuration/project/ProjectConfigurationActionContainer.java b/subprojects/core/src/main/java/org/gradle/configuration/project/ProjectConfigurationActionContainer.java index 27b451ed1c9be..1c051d38752a4 100644 --- a/subprojects/core/src/main/java/org/gradle/configuration/project/ProjectConfigurationActionContainer.java +++ b/subprojects/core/src/main/java/org/gradle/configuration/project/ProjectConfigurationActionContainer.java @@ -16,8 +16,6 @@ package org.gradle.configuration.project; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.internal.project.ProjectInternal; @@ -34,8 +32,4 @@ public interface ProjectConfigurationActionContainer { */ void add(Action action); - /** - * Registers an action to execute to configure the project. Actions are executed in an arbitrary order. - */ - void add(@DelegatesTo(ProjectInternal.class) Closure action); } diff --git a/subprojects/core/src/test/groovy/org/gradle/configuration/project/DefaultProjectConfigurationActionContainerTest.groovy b/subprojects/core/src/test/groovy/org/gradle/configuration/project/DefaultProjectConfigurationActionContainerTest.groovy index 30be9e587f85f..89174aed3b8c1 100644 --- a/subprojects/core/src/test/groovy/org/gradle/configuration/project/DefaultProjectConfigurationActionContainerTest.groovy +++ b/subprojects/core/src/test/groovy/org/gradle/configuration/project/DefaultProjectConfigurationActionContainerTest.groovy @@ -17,7 +17,6 @@ package org.gradle.configuration.project import org.gradle.api.Action -import org.gradle.api.internal.project.ProjectInternal import spock.lang.Specification class DefaultProjectConfigurationActionContainerTest extends Specification { @@ -32,21 +31,4 @@ class DefaultProjectConfigurationActionContainerTest extends Specification { then: container.actions == [action] } - - def "can add action as closure"() { - def run = false - def action = { run = true } - - when: - container.add(action) - - then: - container.actions.size() == 1 - - when: - container.actions[0].execute(Stub(ProjectInternal)) - - then: - run - } } From e2d5dad47155a748dcdfa647d74dd8d8fbe6f236 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:57:31 -0400 Subject: [PATCH 26/40] Remove Closure methods from Ear --- .../main/java/org/gradle/plugins/ear/Ear.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/subprojects/ear/src/main/java/org/gradle/plugins/ear/Ear.java b/subprojects/ear/src/main/java/org/gradle/plugins/ear/Ear.java index 7420aa492cb0e..008847cec806a 100644 --- a/subprojects/ear/src/main/java/org/gradle/plugins/ear/Ear.java +++ b/subprojects/ear/src/main/java/org/gradle/plugins/ear/Ear.java @@ -15,8 +15,6 @@ */ package org.gradle.plugins.ear; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.InvalidUserDataException; import org.gradle.api.file.CopySpec; @@ -40,7 +38,6 @@ import org.gradle.plugins.ear.descriptor.internal.DefaultDeploymentDescriptor; import org.gradle.plugins.ear.descriptor.internal.DefaultEarModule; import org.gradle.plugins.ear.descriptor.internal.DefaultEarWebModule; -import org.gradle.util.internal.ConfigureUtil; import org.gradle.util.internal.GUtil; import org.gradle.work.DisableCachingByDefault; @@ -172,19 +169,6 @@ protected ObjectFactory getObjectFactory() { throw new UnsupportedOperationException(); } - /** - * Configures the deployment descriptor for this EAR archive. - * - *

      The given closure is executed to configure the deployment descriptor. The {@link DeploymentDescriptor} is passed to the closure as its delegate.

      - * - * @param configureClosure The closure. - * @return This. - */ - public Ear deploymentDescriptor(@DelegatesTo(value = DeploymentDescriptor.class, strategy = Closure.DELEGATE_FIRST) Closure configureClosure) { - ConfigureUtil.configure(configureClosure, forceDeploymentDescriptor()); - return this; - } - /** * Configures the deployment descriptor for this EAR archive. * @@ -214,18 +198,6 @@ public CopySpec getLib() { return ((CopySpecInternal) lib).addChild(); } - /** - * Adds dependency libraries to include in the 'lib' directory of the EAR archive. - * - *

      The given closure is executed to configure a {@code CopySpec}. The {@link CopySpec} is passed to the closure as its delegate.

      - * - * @param configureClosure The closure. - * @return The created {@code CopySpec} - */ - public CopySpec lib(@DelegatesTo(value = CopySpec.class, strategy = Closure.DELEGATE_FIRST) Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, getLib()); - } - /** * Adds dependency libraries to include in the 'lib' directory of the EAR archive. * From af9cbaf967f98597937e5dfa628a3e7b1608b859 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 18:58:43 -0400 Subject: [PATCH 27/40] Remove Closure methods from Javadoc --- .../java/org/gradle/api/tasks/javadoc/Javadoc.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/subprojects/language-java/src/main/java/org/gradle/api/tasks/javadoc/Javadoc.java b/subprojects/language-java/src/main/java/org/gradle/api/tasks/javadoc/Javadoc.java index e2d8945b66d09..33a9d90ff4085 100644 --- a/subprojects/language-java/src/main/java/org/gradle/api/tasks/javadoc/Javadoc.java +++ b/subprojects/language-java/src/main/java/org/gradle/api/tasks/javadoc/Javadoc.java @@ -16,8 +16,6 @@ package org.gradle.api.tasks.javadoc; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileTree; @@ -51,7 +49,6 @@ import org.gradle.jvm.toolchain.JavadocTool; import org.gradle.jvm.toolchain.internal.CurrentJvmToolchainSpec; import org.gradle.process.internal.ExecActionFactory; -import org.gradle.util.internal.ConfigureUtil; import javax.annotation.Nullable; import javax.inject.Inject; @@ -365,15 +362,6 @@ public MinimalJavadocOptions getOptions() { return options; } - /** - * Convenience method for configuring Javadoc generation options. - * - * @param block The configuration block for Javadoc generation options. - */ - public void options(@DelegatesTo(MinimalJavadocOptions.class) Closure block) { - ConfigureUtil.configure(block, getOptions()); - } - /** * Convenience method for configuring Javadoc generation options. * From b1c27c4249e87510ceee4aad1c3ffd661d728b6b Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 19:28:26 -0400 Subject: [PATCH 28/40] Remove some Closure taking methods from Test tasks --- ...ClosureBackedMethodInvocationDispatch.java | 72 -------------- .../tasks/testing/TestListenerStub.java | 43 +++++++++ .../api/tasks/testing/AbstractTestTask.java | 93 +++++++++++-------- .../api/tasks/testing/TestListener.java | 4 - .../org/gradle/api/tasks/testing/Test.java | 42 +-------- 5 files changed, 100 insertions(+), 154 deletions(-) delete mode 100644 subprojects/core/src/main/java/org/gradle/listener/ClosureBackedMethodInvocationDispatch.java create mode 100644 subprojects/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/TestListenerStub.java diff --git a/subprojects/core/src/main/java/org/gradle/listener/ClosureBackedMethodInvocationDispatch.java b/subprojects/core/src/main/java/org/gradle/listener/ClosureBackedMethodInvocationDispatch.java deleted file mode 100644 index 52fec7317be0b..0000000000000 --- a/subprojects/core/src/main/java/org/gradle/listener/ClosureBackedMethodInvocationDispatch.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.listener; - -import groovy.lang.Closure; -import org.gradle.internal.dispatch.Dispatch; -import org.gradle.internal.dispatch.MethodInvocation; - -import java.util.Arrays; - -public class ClosureBackedMethodInvocationDispatch implements Dispatch { - private final String methodName; - private final Closure closure; - - public ClosureBackedMethodInvocationDispatch(String methodName, Closure closure) { - this.methodName = methodName; - this.closure = closure; - } - - @Override - public void dispatch(MethodInvocation message) { - if (message.getMethod().getName().equals(methodName)) { - Object[] parameters = message.getArguments(); - if (closure.getMaximumNumberOfParameters() < parameters.length) { - parameters = Arrays.asList(parameters).subList(0, closure.getMaximumNumberOfParameters()).toArray(); - } - closure.call(parameters); - } - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - ClosureBackedMethodInvocationDispatch that = (ClosureBackedMethodInvocationDispatch) o; - - if (!closure.equals(that.closure)) { - return false; - } - if (!methodName.equals(that.methodName)) { - return false; - } - - return true; - } - - @Override - public int hashCode() { - int result = methodName.hashCode(); - result = 31 * result + closure.hashCode(); - return result; - } -} diff --git a/subprojects/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/TestListenerStub.java b/subprojects/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/TestListenerStub.java new file mode 100644 index 0000000000000..6e3e6a29f5c8d --- /dev/null +++ b/subprojects/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/TestListenerStub.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 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.internal.tasks.testing; + +import org.gradle.api.tasks.testing.TestDescriptor; +import org.gradle.api.tasks.testing.TestListener; +import org.gradle.api.tasks.testing.TestResult; + +public class TestListenerStub implements TestListener { + @Override + public void beforeSuite(TestDescriptor suite) { + + } + + @Override + public void afterSuite(TestDescriptor suite, TestResult result) { + + } + + @Override + public void beforeTest(TestDescriptor testDescriptor) { + + } + + @Override + public void afterTest(TestDescriptor testDescriptor, TestResult result) { + + } +} diff --git a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java index f987b93ae8c71..74b596d98740e 100644 --- a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java +++ b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/AbstractTestTask.java @@ -20,7 +20,6 @@ import com.google.common.base.Joiner; import com.google.common.collect.Lists; import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.file.DeleteSpec; import org.gradle.api.file.DirectoryProperty; @@ -30,6 +29,7 @@ import org.gradle.api.internal.tasks.testing.FailFastTestListenerInternal; import org.gradle.api.internal.tasks.testing.TestExecuter; import org.gradle.api.internal.tasks.testing.TestExecutionSpec; +import org.gradle.api.internal.tasks.testing.TestListenerStub; import org.gradle.api.internal.tasks.testing.TestResultProcessor; import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter; import org.gradle.api.internal.tasks.testing.junit.result.Binary2JUnitXmlReportGenerator; @@ -75,8 +75,6 @@ import org.gradle.internal.nativeintegration.network.HostnameLookup; import org.gradle.internal.operations.BuildOperationExecutor; import org.gradle.internal.reflect.Instantiator; -import org.gradle.listener.ClosureBackedMethodInvocationDispatch; -import org.gradle.util.internal.ConfigureUtil; import org.gradle.work.DisableCachingByDefault; import javax.inject.Inject; @@ -214,9 +212,18 @@ public DirectoryProperty getBinaryResultsDirectory() { } /** - * Registers a test listener with this task. Consider also the following handy methods for quicker hooking into test execution: {@link #beforeTest(groovy.lang.Closure)}, {@link - * #afterTest(groovy.lang.Closure)}, {@link #beforeSuite(groovy.lang.Closure)}, {@link #afterSuite(groovy.lang.Closure)}

      This listener will NOT be notified of tests executed by other tasks. To - * get that behavior, use {@link org.gradle.api.invocation.Gradle#addListener(Object)}. + * Registers a test listener with this task. + *

      + * Consider also the following handy methods for quicker hooking into test execution: + *

        + *
      • {@link #beforeTest(Action)}
      • + *
      • {@link #afterTest(groovy.lang.Closure)}
      • + *
      • {@link #beforeSuite(Action)}
      • + *
      • {@link #afterSuite(groovy.lang.Closure)}
      • + *
      + *

      + * This listener will NOT be notified of tests executed by other tasks. + * To get that behavior, use {@link org.gradle.api.invocation.Gradle#addListener(Object)}. * * @param listener The listener to add. */ @@ -301,19 +308,30 @@ private TestExceptionFormatter getExceptionFormatter(TestLogging testLogging) { * * @param closure The closure to call. */ - public void onOutput(Closure closure) { - testOutputListenerBroadcaster.add(new ClosureBackedMethodInvocationDispatch("onOutput", closure)); + public void onOutput(final Closure closure) { + // TODO: Make this a BiConsumer + testOutputListenerBroadcaster.add(new TestOutputListener() { + @Override + public void onOutput(TestDescriptor testDescriptor, TestOutputEvent outputEvent) { + closure.call(testDescriptor, outputEvent); + } + }); } /** - *

      Adds a closure to be notified before a test suite is executed. A {@link TestDescriptor} instance is passed to the closure as a parameter.

      + *

      Adds a action to be notified before a test suite is executed. A {@link TestDescriptor} instance is passed to the action as a parameter.

      * *

      This method is also called before any test suites are executed. The provided descriptor will have a null parent suite.

      * - * @param closure The closure to call. + * @param action The action to call. */ - public void beforeSuite(Closure closure) { - testListenerBroadcaster.add(new ClosureBackedMethodInvocationDispatch("beforeSuite", closure)); + public void beforeSuite(final Action action) { + testListenerBroadcaster.add(new TestListenerStub() { + @Override + public void beforeSuite(TestDescriptor suite) { + action.execute(suite); + } + }); } /** @@ -324,17 +342,28 @@ public void beforeSuite(Closure closure) { * * @param closure The closure to call. */ - public void afterSuite(Closure closure) { - testListenerBroadcaster.add(new ClosureBackedMethodInvocationDispatch("afterSuite", closure)); + public void afterSuite(final Closure closure) { + // TODO: Make this a BiConsumer + testListenerBroadcaster.add(new TestListenerStub() { + @Override + public void afterSuite(TestDescriptor suite, TestResult result) { + closure.call(suite, result); + } + }); } /** - * Adds a closure to be notified before a test is executed. A {@link TestDescriptor} instance is passed to the closure as a parameter. + * Adds a action to be notified before a test is executed. A {@link TestDescriptor} instance is passed to the action as a parameter. * - * @param closure The closure to call. + * @param action The action to call. */ - public void beforeTest(Closure closure) { - testListenerBroadcaster.add(new ClosureBackedMethodInvocationDispatch("beforeTest", closure)); + public void beforeTest(final Action action) { + testListenerBroadcaster.add(new TestListenerStub() { + @Override + public void beforeTest(TestDescriptor suite) { + action.execute(suite); + } + }); } /** @@ -342,8 +371,14 @@ public void beforeTest(Closure closure) { * * @param closure The closure to call. */ - public void afterTest(Closure closure) { - testListenerBroadcaster.add(new ClosureBackedMethodInvocationDispatch("afterTest", closure)); + public void afterTest(final Closure closure) { + // TODO: Make this a BiConsumer + testListenerBroadcaster.add(new TestListenerStub() { + @Override + public void afterTest(TestDescriptor testDescriptor, TestResult result) { + closure.call(testDescriptor, result); + } + }); } /** @@ -367,24 +402,6 @@ public TestLoggingContainer getTestLogging() { return testLogging; } - /** - * Allows configuring the logging of the test execution, for example log eagerly the standard output, etc. - * - *
      -     * apply plugin: 'java'
      -     *
      -     * // makes the standard streams (err and out) visible at console when running tests
      -     * test.testLogging {
      -     *    showStandardStreams = true
      -     * }
      -     * 
      - * - * @param closure configure closure - */ - public void testLogging(@DelegatesTo(TestLoggingContainer.class) Closure closure) { - ConfigureUtil.configure(closure, testLogging); - } - /** * Allows configuring the logging of the test execution, for example log eagerly the standard output, etc. * diff --git a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/TestListener.java b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/TestListener.java index f1398103370a5..bc83119e5d9b4 100644 --- a/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/TestListener.java +++ b/subprojects/testing-base/src/main/java/org/gradle/api/tasks/testing/TestListener.java @@ -16,10 +16,6 @@ package org.gradle.api.tasks.testing; -// todo: consider multithreading/multiprocess issues -// Teamcity has the concept of a "wave" of messages -// where each thread/process uses a unique wave id - import org.gradle.internal.service.scopes.EventScope; import org.gradle.internal.service.scopes.Scopes; diff --git a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java index 918a7f4f07656..919818276f559 100644 --- a/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java +++ b/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java @@ -17,8 +17,6 @@ package org.gradle.api.tasks.testing; import com.google.common.collect.Lists; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.StartParameter; import org.gradle.api.Action; import org.gradle.api.Incubating; @@ -88,7 +86,6 @@ import org.gradle.process.ProcessForkOptions; import org.gradle.process.internal.JavaForkOptionsFactory; import org.gradle.process.internal.worker.WorkerProcessFactory; -import org.gradle.util.internal.ConfigureUtil; import javax.annotation.Nullable; import javax.inject.Inject; @@ -101,7 +98,6 @@ import java.util.concurrent.Callable; import static com.google.common.base.Preconditions.checkState; -import static org.gradle.util.internal.ConfigureUtil.configureUsing; /** * Executes JUnit (3.8.x, 4.x or 5.x) or TestNG tests. Test are always run in (one or more) separate JVMs. @@ -899,9 +895,9 @@ public TestFramework getTestFramework() { return testFramework(null); } - public TestFramework testFramework(@Nullable Closure testFrameworkConfigure) { + public TestFramework testFramework(Action action) { if (!testFramework.isPresent()) { - useJUnit(testFrameworkConfigure); + useJUnit(action); } // To maintain backwards compatibility with builds that may configure the test framework @@ -943,18 +939,6 @@ public TestFrameworkOptions getOptions() { return getTestFramework().getOptions(); } - /** - * Configures test framework specific options. Make sure to call {@link #useJUnit()}, {@link #useJUnitPlatform()} or {@link #useTestNG()} before using this method. - *

      - * Any previous option configuration will be DISCARDED upon changing the test framework. Accessing options prior to setting the test framework will be - * deprecated in Gradle 8. - * - * @return The test framework options. - */ - public TestFrameworkOptions options(@DelegatesTo(TestFrameworkOptions.class) Closure testFrameworkConfigure) { - return ConfigureUtil.configure(testFrameworkConfigure, getOptions()); - } - /** * Configures test framework specific options. Make sure to call {@link #useJUnit()}, {@link #useJUnitPlatform()} or {@link #useTestNG()} before using this method. * @@ -1003,17 +987,6 @@ public void useJUnit() { useJUnit(Actions.doNothing()); } - /** - * Specifies that JUnit4 should be used to discover and execute the tests with additional configuration. - *

      - * The supplied action configures an instance of {@link org.gradle.api.tasks.testing.junit.JUnitOptions JUnit4 specific options}. - * - * @param testFrameworkConfigure A closure used to configure JUnit4 options. - */ - public void useJUnit(@Nullable @DelegatesTo(JUnitOptions.class) Closure testFrameworkConfigure) { - useJUnit(ConfigureUtil.configureUsing(testFrameworkConfigure)); - } - /** * Specifies that JUnit4 should be used to discover and execute the tests with additional configuration. *

      @@ -1067,17 +1040,6 @@ public void useTestNG() { useTestNG(Actions.doNothing()); } - /** - * Specifies that TestNG should be used to discover and execute the tests with additional configuration. - *

      - * The supplied action configures an instance of {@link org.gradle.api.tasks.testing.testng.TestNGOptions TestNG specific options}. - * - * @param testFrameworkConfigure A closure used to configure TestNG options. - */ - public void useTestNG(@DelegatesTo(TestNGOptions.class) Closure testFrameworkConfigure) { - useTestNG(configureUsing(testFrameworkConfigure)); - } - /** * Specifies that TestNG should be used to discover and execute the tests with additional configuration. *

      From f60ea719822f3679dc5bba94f59477ee5936ac6a Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sat, 24 Sep 2022 19:33:28 -0400 Subject: [PATCH 29/40] Remove Closure from SourceSet --- .../api/internal/tasks/DefaultSourceSet.java | 14 ------------ .../java/org/gradle/api/tasks/SourceSet.java | 22 ------------------- 2 files changed, 36 deletions(-) diff --git a/subprojects/plugins/src/main/java/org/gradle/api/internal/tasks/DefaultSourceSet.java b/subprojects/plugins/src/main/java/org/gradle/api/internal/tasks/DefaultSourceSet.java index f68bf3a26a937..d56f1f5e2217b 100644 --- a/subprojects/plugins/src/main/java/org/gradle/api/internal/tasks/DefaultSourceSet.java +++ b/subprojects/plugins/src/main/java/org/gradle/api/internal/tasks/DefaultSourceSet.java @@ -15,7 +15,6 @@ */ package org.gradle.api.internal.tasks; -import groovy.lang.Closure; import org.apache.commons.lang.StringUtils; import org.gradle.api.Action; import org.gradle.api.file.FileCollection; @@ -30,7 +29,6 @@ import javax.annotation.Nullable; import static org.gradle.api.internal.lambdas.SerializableLambdas.spec; -import static org.gradle.util.internal.ConfigureUtil.configure; public abstract class DefaultSourceSet implements SourceSet { private final String name; @@ -254,12 +252,6 @@ public SourceDirectorySet getJava() { return javaSource; } - @Override - public SourceSet java(@Nullable Closure configureClosure) { - configure(configureClosure, getJava()); - return this; - } - @Override public SourceSet java(Action configureAction) { configureAction.execute(getJava()); @@ -276,12 +268,6 @@ public SourceDirectorySet getResources() { return resources; } - @Override - public SourceSet resources(@Nullable Closure configureClosure) { - configure(configureClosure, getResources()); - return this; - } - @Override public SourceSet resources(Action configureAction) { configureAction.execute(getResources()); diff --git a/subprojects/plugins/src/main/java/org/gradle/api/tasks/SourceSet.java b/subprojects/plugins/src/main/java/org/gradle/api/tasks/SourceSet.java index 761d92e5dfdaa..89cd94269ded2 100644 --- a/subprojects/plugins/src/main/java/org/gradle/api/tasks/SourceSet.java +++ b/subprojects/plugins/src/main/java/org/gradle/api/tasks/SourceSet.java @@ -15,8 +15,6 @@ */ package org.gradle.api.tasks; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.file.FileCollection; @@ -140,16 +138,6 @@ public interface SourceSet extends ExtensionAware { */ SourceDirectorySet getResources(); - /** - * Configures the non-Java resources for this set. - * - *

      The given closure is used to configure the {@link SourceDirectorySet} which contains the resources. - * - * @param configureClosure The closure to use to configure the resources. - * @return this - */ - SourceSet resources(@Nullable @DelegatesTo(SourceDirectorySet.class) Closure configureClosure); - /** * Configures the non-Java resources for this set. * @@ -167,16 +155,6 @@ public interface SourceSet extends ExtensionAware { */ SourceDirectorySet getJava(); - /** - * Configures the Java source for this set. - * - *

      The given closure is used to configure the {@link SourceDirectorySet} which contains the Java source. - * - * @param configureClosure The closure to use to configure the Java source. - * @return this - */ - SourceSet java(@Nullable @DelegatesTo(SourceDirectorySet.class) Closure configureClosure); - /** * Configures the Java source for this set. * From 33b62c96d254b189f9b93e60da1d78e62ed96907 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 14:43:33 -0400 Subject: [PATCH 30/40] Make sanityCheck happy --- .../api/internal/DefaultNamedDomainObjectCollection.java | 3 +-- .../internal/NamedDomainObjectContainerConfigureDelegate.java | 1 + .../internal/enterprise/GradleEnterprisePluginService.java | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java index 7a56d4924cf62..1140f92a2ef0f 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/DefaultNamedDomainObjectCollection.java @@ -39,7 +39,6 @@ import org.gradle.api.provider.Provider; import org.gradle.api.reflect.TypeOf; import org.gradle.api.specs.Spec; -import org.gradle.api.specs.Specs; import org.gradle.internal.Cast; import org.gradle.internal.ImmutableActionSet; import org.gradle.internal.metaobject.AbstractDynamicObject; @@ -523,7 +522,7 @@ public DynamicInvokeResult tryInvokeMethod(String name, Object... arguments) { } private boolean isConfigureMethod(String name, Object... arguments) { - return (arguments.length == 1 && arguments[0] instanceof Closure) && hasProperty(name); + return arguments.length == 1 && arguments[0] instanceof Closure && hasProperty(name); } } diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java b/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java index f6e34f84cc085..9bf25e3cac4d8 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/NamedDomainObjectContainerConfigureDelegate.java @@ -35,6 +35,7 @@ protected DynamicInvokeResult _configure(String name) { return DynamicInvokeResult.found(_container.create(name)); } + @SuppressWarnings("unchecked") @Override protected DynamicInvokeResult _configure(String name, Object[] params) { if (params.length == 1 && params[0] instanceof Closure) { diff --git a/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java b/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java index 5b8cac4b91009..71e6773e64d8a 100644 --- a/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java +++ b/subprojects/enterprise/src/main/java/org/gradle/internal/enterprise/GradleEnterprisePluginService.java @@ -16,7 +16,6 @@ package org.gradle.internal.enterprise; -import groovy.lang.Closure; import org.gradle.internal.operations.notify.BuildOperationNotificationListener; /** From 93355139b8d1ef177bebb4f508807c68c6cabc7b Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 14:47:42 -0400 Subject: [PATCH 31/40] Fix javadoc generation --- .../src/main/java/org/gradle/util/ClosureBackedAction.java | 2 -- .../model-core/src/main/java/org/gradle/util/ConfigureUtil.java | 1 - 2 files changed, 3 deletions(-) diff --git a/subprojects/model-core/src/main/java/org/gradle/util/ClosureBackedAction.java b/subprojects/model-core/src/main/java/org/gradle/util/ClosureBackedAction.java index 6e3e8cec1c5f9..df27aeca2de87 100644 --- a/subprojects/model-core/src/main/java/org/gradle/util/ClosureBackedAction.java +++ b/subprojects/model-core/src/main/java/org/gradle/util/ClosureBackedAction.java @@ -25,8 +25,6 @@ /** * This class is only here to maintain binary compatibility with existing plugins. - *

      - * To apply a configuration (represented by a Groovy closure) on an object, use {@link org.gradle.api.Project#configure(Object, Closure)}. * * @deprecated Will be removed in Gradle 9.0. * @param The action type. diff --git a/subprojects/model-core/src/main/java/org/gradle/util/ConfigureUtil.java b/subprojects/model-core/src/main/java/org/gradle/util/ConfigureUtil.java index 4709d562b50ba..19b4ba7db61f8 100644 --- a/subprojects/model-core/src/main/java/org/gradle/util/ConfigureUtil.java +++ b/subprojects/model-core/src/main/java/org/gradle/util/ConfigureUtil.java @@ -65,7 +65,6 @@ *

      * Gradle automatically generates a Closure-taking method at runtime for each method with an {@link Action} as a single argument as long as the object is created with {@link org.gradle.api.model.ObjectFactory#newInstance(Class, Object...)}. *

      - * As a last resort, to apply some configuration represented by a Groovy Closure, a plugin can use {@link org.gradle.api.Project#configure(Object, Closure)}. * * @deprecated Will be removed in Gradle 9.0. */ From 6c91e733f62f7e25954f0d500269a9f8673d057a Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 14:51:25 -0400 Subject: [PATCH 32/40] Update archunit baseline input --- .../3c3e47be-b5ed-426a-8b9f-cfa00d3b09db | 36 +-- .../provider-task-file-collection.txt | 54 ++--- .../provider-task-properties.txt | 226 +++++++++--------- .../archunit_store/provider-text-resource.txt | 8 +- .../public-api-mutable-file-collection.txt | 8 +- .../public-api-mutable-properties.txt | 156 ++++++------ .../public-api-mutable-text-resource.txt | 4 +- 7 files changed, 246 insertions(+), 246 deletions(-) diff --git a/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db b/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db index a76925e4c6b1e..972aa833ced51 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db +++ b/subprojects/architecture-test/src/changes/archunit_store/3c3e47be-b5ed-426a-8b9f-cfa00d3b09db @@ -1,17 +1,17 @@ -Method has arguments/return type org.gradle.api.internal.TaskInputsInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:299) -Method has arguments/return type org.gradle.api.internal.TaskOutputsInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:304) -Method has arguments/return type org.gradle.api.internal.tasks.TaskStateInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:274) -Method has arguments/return type org.gradle.api.internal.tasks.TaskDependencyInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:279) +Method has arguments/return type org.gradle.api.internal.TaskInputsInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:288) +Method has arguments/return type org.gradle.api.internal.TaskOutputsInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:293) +Method has arguments/return type org.gradle.api.internal.tasks.TaskStateInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:273) +Method has arguments/return type org.gradle.api.internal.tasks.TaskDependencyInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (DefaultTask.java:278) Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ExclusiveContentRepository.java:0) Method has arguments/return type org.gradle.internal.metaobject.DynamicObject that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Convention.java:0) Method has arguments/return type org.gradle.api.internal.project.ProjectInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (JavaPluginConvention.java:0) -Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Checkstyle.java:123) -Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CodeNarc.java:127) -Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Pmd.java:117) +Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Checkstyle.java:122) +Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CodeNarc.java:125) +Method has arguments/return type org.gradle.api.internal.project.IsolatedAntBuilder that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Pmd.java:114) Method has arguments/return type org.gradle.api.internal.attributes.ImmutableAttributes that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GenerateMavenPom.java:65) Method has arguments/return type org.gradle.api.internal.attributes.ImmutableAttributes that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GenerateMavenPom.java:70) -Method has arguments/return type org.gradle.api.reporting.GenerateBuildDashboard$ReportState that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GenerateBuildDashboard.java:73) -Method has arguments/return type org.gradle.api.internal.file.copy.CopySpecInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (AbstractCopyTask.java:173) +Method has arguments/return type org.gradle.api.reporting.GenerateBuildDashboard$ReportState that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GenerateBuildDashboard.java:71) +Method has arguments/return type org.gradle.api.internal.file.copy.CopySpecInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (AbstractCopyTask.java:170) Method has arguments/return type org.gradle.api.internal.file.copy.CopySpecInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Copy.java:69) Method has arguments/return type org.gradle.api.internal.file.copy.DestinationRootCopySpec that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Copy.java:88) Method has arguments/return type org.gradle.api.internal.file.copy.CopySpecInternal that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Sync.java:67) @@ -25,12 +25,12 @@ Method has a Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.PropertyReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PropertyReportTask.java:67) Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.ReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (TaskReportTask.java:69) Method has arguments/return type org.gradle.api.tasks.diagnostics.internal.TaskReportRenderer that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (TaskReportTask.java:76) -Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:199) -Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:208) +Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:198) +Method has arguments/return type org.gradle.api.internal.tasks.AntGroovydoc that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Groovydoc.java:207) Method has arguments/return type org.gradle.language.base.internal.compile.Compiler that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ScalaCompile.java:123) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:915) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:910) -Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:919) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:895) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:890) +Method has arguments/return type org.gradle.api.internal.tasks.testing.TestFramework that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Test.java:899) Method has arguments/return type org.gradle.buildinit.plugins.internal.ProjectLayoutSetupRegistry that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (InitBuild.java:177) Method has arguments/return type org.gradle.external.javadoc.internal.JavadocOptionFileWriterContext that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (OptionLessJavadocOptionFileOption.java:0) Method has arguments/return type org.gradle.internal.operations.logging.BuildOperationLoggerFactory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (Assemble.java:85) @@ -67,7 +67,7 @@ Method h Method has arguments/return type org.bouncycastle.openpgp.PGPSignatureGenerator that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatory.java:106) Method has arguments/return type org.bouncycastle.openpgp.PGPSecretKey that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatoryFactory.java:73) Method has arguments/return type org.bouncycastle.openpgp.PGPSecretKey that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (PgpSignatoryFactory.java:121) -Method has arguments/return type org.gradle.internal.Pair that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CollectionUtils.java:590) -Method has arguments/return type org.gradle.internal.metaobject.ConfigureDelegate that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ConfigureUtil.java:179) -Method has arguments/return type java.util.zip.Checksum that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GFileUtils.java:279) -Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GUtil.java:176) \ No newline at end of file +Method has arguments/return type org.gradle.internal.Pair that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (CollectionUtils.java:656) +Method has arguments/return type org.gradle.internal.metaobject.ConfigureDelegate that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (ConfigureUtil.java:191) +Method has arguments/return type java.util.zip.Checksum that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GFileUtils.java:329) +Method has arguments/return type org.gradle.internal.Factory that is not Gradle public API or primitive or built-in JDK classes or Groovy classes in (GUtil.java:195) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt index d2217938e9a67..d394af55acf9f 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-task-file-collection.txt @@ -1,43 +1,43 @@ Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AntlrTask.java:181) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AntlrTask.java:298) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:246) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:261) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:238) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:192) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:209) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:104) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:439) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:241) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:333) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:233) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:221) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:236) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Checkstyle.java:213) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:182) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:199) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CodeNarc.java:102) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:427) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:229) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:321) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Pmd.java:221) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaExec.java:263) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaExec.java:488) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceTask.java:72) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceTask.java:71) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Upload.java:115) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (War.java:130) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (War.java:129) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AbstractCompile.java:57) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:114) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:389) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:358) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:403) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:120) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (DependencyInsightReportTask.java:201) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:187) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:170) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:143) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:336) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:229) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:115) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:390) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GroovyCompile.java:359) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:412) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaCompile.java:122) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (DependencyInsightReportTask.java:200) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:186) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:169) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Groovydoc.java:142) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:333) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Javadoc.java:226) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaCompile.java:70) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaCompile.java:84) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaCompile.java:112) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:151) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:163) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (ScalaDoc.java:113) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:355) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:1124) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:823) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:353) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:1070) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (Test.java:803) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (GenerateXcodeWorkspaceFileTask.java:60) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CreateStartScripts.java:320) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AbstractScalaCompile.java:280) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (AbstractScalaCompile.java:279) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (InstallExecutable.java:164) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JacocoBase.java:36) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt index 114b7948e5ba8..29e544fbc544f 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-task-properties.txt @@ -5,29 +5,29 @@ Method does not have raw retu Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:95) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:107) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntlrTask.java:119) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:100) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:297) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:338) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:368) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:390) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:328) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:63) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:348) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:410) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:95) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:299) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:245) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:260) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:275) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CodeNarc.java:291) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CodeNarc.java:56) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:366) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:474) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:354) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:69) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:260) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:279) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:414) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:99) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:272) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:313) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:343) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:365) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:303) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Checkstyle.java:60) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:323) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Checkstyle.java:385) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:93) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:289) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:235) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:250) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarc.java:265) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CodeNarc.java:281) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CodeNarc.java:54) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:354) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:462) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:342) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Pmd.java:66) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:248) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:267) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Pmd.java:402) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateIvyDescriptor.java:62) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateIvyDescriptor.java:76) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PublishToIvyRepository.java:78) @@ -36,27 +36,27 @@ Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateMavenPom.java:95) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateMavenPom.java:81) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PublishToMavenRepository.java:69) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:73) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:142) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:50) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HtmlDependencyReportTask.java:162) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HtmlDependencyReportTask.java:68) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HtmlDependencyReportTask.java:96) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:71) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:140) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateBuildDashboard.java:48) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HtmlDependencyReportTask.java:154) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HtmlDependencyReportTask.java:66) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HtmlDependencyReportTask.java:94) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependentComponentsReport.java:107) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependentComponentsReport.java:87) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependentComponentsReport.java:61) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependentComponentsReport.java:74) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ModelReport.java:76) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ModelReport.java:66) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:538) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:233) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:440) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:547) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:592) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:208) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:422) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractCopyTask.java:173) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:191) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:482) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:230) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:401) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:491) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:527) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:205) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:383) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractCopyTask.java:170) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCopyTask.java:188) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractExecTask.java:136) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractExecTask.java:145) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractExecTask.java:154) @@ -99,8 +99,8 @@ Method does not have raw ret Method does not have raw return type assignable to org.gradle.api.provider.Property in (JavaExec.java:229) Method does not have raw return type assignable to org.gradle.api.provider.Property in (JavaExec.java:559) Method does not have raw return type assignable to org.gradle.api.provider.Property in (JavaExec.java:700) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (SourceTask.java:201) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (SourceTask.java:183) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (SourceTask.java:182) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (SourceTask.java:164) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Sync.java:104) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Sync.java:125) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Sync.java:67) @@ -116,31 +116,31 @@ Method does not have raw Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntTarget.java:66) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntTarget.java:82) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AntTarget.java:51) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:286) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:112) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractArchiveTask.java:164) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:241) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:419) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:198) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:375) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:331) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:511) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:540) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:285) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:111) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractArchiveTask.java:163) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:240) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:418) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:197) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:374) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:330) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:495) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractArchiveTask.java:524) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Tar.java:59) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (War.java:90) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (War.java:172) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (War.java:89) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (War.java:171) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Zip.java:76) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Zip.java:123) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Zip.java:111) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCompile.java:97) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCompile.java:145) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractCompile.java:164) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:369) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:379) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:386) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:396) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:51) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:73) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:370) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GroovyCompile.java:380) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:395) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JavaCompile.java:405) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:48) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractConfigurationReportTask.java:70) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractDependencyReportTask.java:111) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractDependencyReportTask.java:54) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractDependencyReportTask.java:0) @@ -148,66 +148,66 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractReportTask.java:140) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ConventionReportTask.java:88) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ConventionReportTask.java:109) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:167) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:233) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:166) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (DependencyInsightReportTask.java:232) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (DependencyReportTask.java:30) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PropertyReportTask.java:63) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:114) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:142) Method does not have raw return type assignable to org.gradle.api.provider.Property in (TaskReportTask.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (TaskReportTask.java:92) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:199) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:153) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:282) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:320) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:301) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:443) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:263) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:231) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:246) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:216) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:251) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:416) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:276) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:355) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:365) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:402) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:297) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:393) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:314) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:198) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:152) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:281) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:319) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:300) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:400) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:262) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:230) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:245) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Groovydoc.java:215) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:248) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:404) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:273) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:352) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:362) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Javadoc.java:390) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:294) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:381) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Javadoc.java:311) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ScalaCompile.java:42) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ScalaCompile.java:62) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ScalaDoc.java:94) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ScalaDoc.java:175) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ScalaDoc.java:189) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:627) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractTestTask.java:265) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:102) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:571) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:368) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:547) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:494) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:512) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:388) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:478) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:572) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:887) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:288) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:539) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1160) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:864) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:279) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:428) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:436) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:412) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1194) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:380) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:632) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:958) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:321) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:915) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:243) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1137) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:632) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractTestTask.java:271) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:587) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:99) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (AbstractTestTask.java:402) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:545) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:492) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:510) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:386) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:476) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:570) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:867) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:286) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:537) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1106) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:844) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:277) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:426) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:434) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:410) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1140) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:378) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:630) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:938) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:319) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Test.java:895) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:241) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Test.java:1083) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Wrapper.java:426) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Wrapper.java:409) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Wrapper.java:309) @@ -244,7 +244,7 @@ Method does not have raw return type assignable to org.gradle.api.provider.Provider in (GenerateSolutionFileTask.java:57) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateSchemeFileTask.java:128) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateSchemeFileTask.java:51) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeProjectFileTask.java:317) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeProjectFileTask.java:319) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GenerateXcodeWorkspaceFileTask.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CreateStartScripts.java:298) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CreateStartScripts.java:285) @@ -283,9 +283,9 @@ Method does not have raw return type assignable to org.gradle.api.provider.Property in (RunTestExecutable.java:91) Method does not have raw return type assignable to org.gradle.api.provider.Property in (RunTestExecutable.java:78) Method does not have raw return type assignable to org.gradle.api.provider.Property in (RunTestExecutable.java:96) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Ear.java:274) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Ear.java:215) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (Ear.java:252) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Ear.java:245) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Ear.java:198) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (Ear.java:223) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GeneratorTask.java:117) Method does not have raw return type assignable to org.gradle.api.provider.Property in (GeneratorTask.java:149) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PropertyListGeneratorTask.java:55) @@ -314,5 +314,5 @@ Method does not have raw Method does not have raw return type assignable to org.gradle.api.provider.Provider in (Sign.java:251) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Sign.java:318) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JacocoCoverageVerification.java:59) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JacocoReport.java:35) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JacocoReport.java:64) \ No newline at end of file +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JacocoReport.java:33) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (JacocoReport.java:62) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt b/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt index 419a2a67dd169..efc4c890650a5 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/provider-text-resource.txt @@ -1,4 +1,4 @@ -Method has raw return type org.gradle.api.resources.TextResource in (Checkstyle.java:278) -Method has raw return type org.gradle.api.resources.TextResource in (CodeNarc.java:228) -Method has raw return type org.gradle.api.resources.TextResource in (Pmd.java:304) -Method has raw return type org.gradle.api.resources.TextResource in (Groovydoc.java:339) \ No newline at end of file +Method has raw return type org.gradle.api.resources.TextResource in (Checkstyle.java:253) +Method has raw return type org.gradle.api.resources.TextResource in (CodeNarc.java:218) +Method has raw return type org.gradle.api.resources.TextResource in (Pmd.java:292) +Method has raw return type org.gradle.api.resources.TextResource in (Groovydoc.java:338) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt index 57c52d54020c1..3164650bdcea5 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-file-collection.txt @@ -1,10 +1,10 @@ -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (PmdExtension.java:185) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (PmdExtension.java:184) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SourceSet.java:0) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:432) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:274) -Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:410) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:453) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:277) +Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (CompileOptions.java:431) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (SigningExtension.java:278) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaExecSpec.java:0) Method does not have raw return type assignable to org.gradle.api.file.ConfigurableFileCollection in (JavaForkOptions.java:0) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt index 71bef2c89fe58..4f066648b7e69 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-properties.txt @@ -175,11 +175,11 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Provider in (WarPluginConvention.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (WarPluginConvention.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (WarPluginConvention.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:51) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:83) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:116) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:139) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:158) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:57) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:89) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:122) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:145) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CheckstyleExtension.java:164) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarcExtension.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarcExtension.java:83) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeNarcExtension.java:97) @@ -189,9 +189,9 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:51) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:37) Method does not have raw return type assignable to org.gradle.api.provider.Property in (CodeQualityExtension.java:67) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:64) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:95) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:217) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:63) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:94) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PmdExtension.java:216) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IvyArtifact.java:0) @@ -241,46 +241,46 @@ Method does n Method does not have raw return type assignable to org.gradle.api.provider.Provider in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (SourceSet.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (SourceSet.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (SourceSet.java:400) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (SourceSet.java:378) Method does not have raw return type assignable to org.gradle.api.provider.Property in (SourceSetOutput.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (TaskExecutionException.java:35) Method does not have raw return type assignable to org.gradle.api.provider.Property in (VerificationTask.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BaseForkOptions.java:83) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BaseForkOptions.java:47) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BaseForkOptions.java:64) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CompileOptions.java:326) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:505) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:316) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CompileOptions.java:341) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:221) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:188) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:293) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:255) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:205) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:155) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:110) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:238) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:385) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:140) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:125) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:170) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CompileOptions.java:329) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:526) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:319) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (CompileOptions.java:344) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:224) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:191) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:296) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:258) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:208) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:158) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:113) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:241) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:388) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:143) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:128) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (CompileOptions.java:173) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DebugOptions.java:52) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ForkOptions.java:49) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ForkOptions.java:73) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ForkOptions.java:95) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:194) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:127) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:333) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:258) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:286) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:316) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:82) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:142) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:220) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:351) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:112) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:239) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:97) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:193) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:126) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:331) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:257) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:285) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:314) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:81) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:141) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:219) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:349) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:111) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:238) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (GroovyCompileOptions.java:96) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ProviderAwareCompilerDaemonForkOptions.java:60) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ProviderAwareCompilerDaemonForkOptions.java:49) Method does not have raw return type assignable to org.gradle.api.provider.Property in (ScalaDocOptions.java:165) @@ -339,24 +339,24 @@ Method doe Method does not have raw return type assignable to org.gradle.api.provider.Property in (TestNGOptions.java:320) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternFilterable.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternFilterable.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:173) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:169) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:165) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:226) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:219) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:185) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:178) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:240) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:158) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:171) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:167) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:163) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:224) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:217) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:183) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:176) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (PatternSet.java:238) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (PatternSet.java:156) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractBuildCache.java:33) Method does not have raw return type assignable to org.gradle.api.provider.Property in (AbstractBuildCache.java:49) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BuildCache.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (BuildCache.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HttpBuildCache.java:98) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:70) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:155) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:124) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:196) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (HttpBuildCache.java:97) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:69) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:154) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:123) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCache.java:193) Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCacheCredentials.java:61) Method does not have raw return type assignable to org.gradle.api.provider.Property in (HttpBuildCacheCredentials.java:40) Method does not have raw return type assignable to org.gradle.api.provider.Property in (DirectoryBuildCache.java:38) @@ -636,8 +636,8 @@ Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:290) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:219) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpComponent.java:206) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpFacet.java:129) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (EclipseWtpFacet.java:94) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseWtpFacet.java:131) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (EclipseWtpFacet.java:96) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:77) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:69) Method does not have raw return type assignable to org.gradle.api.provider.Property in (Facet.java:85) @@ -692,28 +692,28 @@ Method does not have r Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModel.java:56) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModel.java:80) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModel.java:69) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:329) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:444) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:260) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaModule.java:555) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:458) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:516) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:530) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:234) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:472) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:624) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:569) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:500) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaModule.java:565) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:384) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:296) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:588) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:247) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:544) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:486) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:318) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:307) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:580) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:314) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:363) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:245) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaModule.java:474) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:377) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:435) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:449) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:219) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:391) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:543) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:488) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:419) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaModule.java:484) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:337) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:281) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:507) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:232) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:463) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:405) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:303) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:292) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModule.java:499) Method does not have raw return type assignable to org.gradle.api.provider.Property in (IdeaModuleIml.java:43) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaProject.java:147) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (IdeaProject.java:168) @@ -856,7 +856,7 @@ Method does not have raw return type assignable to org.gradle.api.provider.Provider in (UnexpectedBuildResultException.java:40) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ListenerFailedException.java:39) Method does not have raw return type assignable to org.gradle.api.provider.Property in (EclipseRuntime.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ConfigureUtil.java:121) +Method does not have raw return type assignable to org.gradle.api.provider.Provider in (ConfigureUtil.java:129) Method does not have raw return type assignable to org.gradle.api.provider.Property in (VersionControlRepository.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Provider in (VersionControlSpec.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (VersionControlSpec.java:0) @@ -864,4 +864,4 @@ Method does not have raw retur Method does not have raw return type assignable to org.gradle.api.provider.Property in (GitVersionControlSpec.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (WorkerConfiguration.java:0) Method does not have raw return type assignable to org.gradle.api.provider.Property in (WorkerConfiguration.java:0) -Method does not have raw return type assignable to org.gradle.api.provider.Property in (WorkerConfiguration.java:0) +Method does not have raw return type assignable to org.gradle.api.provider.Property in (WorkerConfiguration.java:0) \ No newline at end of file diff --git a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt index 0eec6a286d0d6..c3aff5465c00f 100644 --- a/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt +++ b/subprojects/architecture-test/src/changes/archunit_store/public-api-mutable-text-resource.txt @@ -1,5 +1,5 @@ -Method has raw return type org.gradle.api.resources.TextResource in (CheckstyleExtension.java:67) +Method has raw return type org.gradle.api.resources.TextResource in (CheckstyleExtension.java:73) Method has raw return type org.gradle.api.resources.TextResource in (CodeNarcExtension.java:53) -Method has raw return type org.gradle.api.resources.TextResource in (PmdExtension.java:158) +Method has raw return type org.gradle.api.resources.TextResource in (PmdExtension.java:157) Method has raw return type org.gradle.api.resources.TextResource in (CustomizableHtmlReport.java:0) Method has raw return type org.gradle.api.resources.TextResource in (TemplateBasedScriptGenerator.java:0) \ No newline at end of file From 6021c8b0952e38601ce92dfd7ce00701ed546442 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 15:18:38 -0400 Subject: [PATCH 33/40] Revert "Remove the rest of the Closure taking methods from Project" This reverts commit 6ffcc30d40af209571e189b399d389dda514169d. --- ...ProblemReportingCrossProjectModelAccess.kt | 26 +++++++ .../src/main/java/org/gradle/api/Project.java | 75 ++++++++++++++++++- .../api/internal/project/DefaultProject.java | 22 ++++++ .../dsl/support/delegates/ProjectDelegate.kt | 16 ++++ 4 files changed, 136 insertions(+), 3 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index c854abe40bdd1..f6f26df3decbf 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -16,6 +16,7 @@ package org.gradle.configurationcache +import groovy.lang.Closure import groovy.lang.GroovyObjectSupport import groovy.lang.Script import org.gradle.api.Action @@ -298,6 +299,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.task(args, name) } + override fun task(args: MutableMap, name: String, configureClosure: Closure<*>): Task { + onAccess() + return delegate.task(args, name, configureClosure) + } + override fun task(args: MutableMap, name: String, action: Action): Task { onAccess() return delegate.task(args, name, action) @@ -479,6 +485,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.configurations } + override fun configurations(configureClosure: Closure<*>) { + onAccess() + delegate.configurations(configureClosure) + } + override fun configurations(action: Action) { onAccess() delegate.configurations(action) @@ -599,6 +610,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.repositories } + override fun repositories(configureClosure: Closure<*>) { + onAccess() + delegate.repositories(configureClosure) + } + override fun repositories(action: Action) { onAccess() delegate.repositories(action) @@ -609,6 +625,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.dependencies } + override fun dependencies(configureClosure: Closure<*>) { + onAccess() + delegate.dependencies(configureClosure) + } + override fun dependencies(action: Action) { onAccess() delegate.dependencies(action) @@ -654,6 +675,11 @@ class ProblemReportingCrossProjectModelAccess( return delegate.container(type, factory) } + override fun container(type: Class, factoryClosure: Closure<*>): NamedDomainObjectContainer { + onAccess() + return delegate.container(type, factoryClosure) + } + override fun getResources(): ResourceHandler { onAccess() return delegate.resources diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 3ddcdd9a0508b..5b4802d562994 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -16,6 +16,7 @@ package org.gradle.api; +import groovy.lang.Closure; import groovy.lang.MissingPropertyException; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.dsl.ArtifactHandler; @@ -205,7 +206,8 @@ * *

    • The tasks of the project. A method is added for each task, using the name of the task as the method name and * taking a single {@link org.gradle.api.Action} parameter. The method calls the {@link Task#configure(Action)} method for the - * associated task with the provided configuration.
    • + * associated task with the provided closure. For example, if the project has a task called compile, then a + * method is added with the following signature: void compile(Closure configureClosure). * *
    • The methods of the parent project, recursively up to the root project.
    • * @@ -485,6 +487,25 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Task task(Map args, String name) throws InvalidUserDataException; + /** + *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given + * closure is executed to configure the task. A map of creation options can be passed to this method to control how + * the task is created. See {@link #task(java.util.Map, String)} for the available options.

      + * + *

      After the task is added to the project, it is made available as a property of the project, so that you can + * reference the task by name in your build file. See here for more details

      + * + *

      If a task with the given name already exists in this project and the override option is not set + * to true, an exception is thrown.

      + * + * @param args The task creation options. + * @param name The name of the task to be created + * @param configureClosure The closure to use to configure the created task. + * @return The newly created task object + * @throws InvalidUserDataException If a task with the given name already exists in this project. + */ + Task task(Map args, String name, Closure configureClosure); + /** *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given * closure is executed to configure the task. A map of creation options can be passed to this method to control how @@ -649,7 +670,7 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar * *

    • A {@link org.gradle.api.resources.TextResource}.
    • * - *
    • A Groovy {@link groovy.lang.Closure} or Kotlin function that returns any supported type. The closure's return value is resolved recursively.
    • + *
    • A Groovy {@link Closure} or Kotlin function that returns any supported type. The closure's return value is resolved recursively.
    • * *
    • A {@link java.util.concurrent.Callable} that returns any supported type. The callable's return value is resolved recursively.
    • * @@ -715,7 +736,7 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar * *
    • A {@link java.util.concurrent.Callable} that returns any supported type. The return value of the {@code call()} method is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • * - *
    • A Groovy {@link groovy.lang.Closure} or Kotlin function that returns any of the types listed here. The return value of the closure is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • + *
    • A Groovy {@link Closure} or Kotlin function that returns any of the types listed here. The return value of the closure is recursively converted to files. A {@code null} return value is treated as an empty collection.
    • * *
    • A {@link Task}. Converted to the task's output files. The task is executed if the file collection is used as an input to another task.
    • * @@ -1071,6 +1092,18 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ ConfigurationContainer getConfigurations(); + /** + *

      Configures the dependency configurations for this project. + * + *

      This method executes the given closure against the {@link ConfigurationContainer} + * for this project. The {@link ConfigurationContainer} is passed to the closure as the closure's delegate. + * + *

      Examples:

      See docs for {@link ConfigurationContainer} + * + * @param configureClosure the closure to use to configure the dependency configurations. + */ + void configurations(Closure configureClosure); + /** *

      Configures the dependency configurations for this project. * @@ -1319,6 +1352,16 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ RepositoryHandler getRepositories(); + /** + *

      Configures the repositories for this project. + * + *

      This method executes the given closure against the {@link RepositoryHandler} for this project. The {@link + * RepositoryHandler} is passed to the closure as the closure's delegate. + * + * @param configureClosure the closure to use to configure the repositories. + */ + void repositories(Closure configureClosure); + /** *

      Configures the repositories for this project. * @@ -1342,6 +1385,19 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ DependencyHandler getDependencies(); + /** + *

      Configures the dependencies for this project. + * + *

      This method executes the given closure against the {@link DependencyHandler} for this project. The {@link + * DependencyHandler} is passed to the closure as the closure's delegate. + * + *

      Examples:

      + * See docs for {@link DependencyHandler} + * + * @param configureClosure the closure to use to configure the dependencies. + */ + void dependencies(Closure configureClosure); + /** *

      Configures the dependencies for this project. * @@ -1508,6 +1564,19 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ NamedDomainObjectContainer container(Class type, NamedDomainObjectFactory factory); + /** + *

      Creates a container for managing named objects of the specified type. The given closure is used to create object instances. The name of the instance to be created is passed as a parameter to + * the closure.

      + * + *

      All objects MUST expose their name as a bean property named "name". The name must be constant for the life of the object.

      + * + * @param type The type of objects for the container to contain. + * @param factoryClosure The closure to use to create object instances. + * @param The type of objects for the container to contain. + * @return The container. + */ + NamedDomainObjectContainer container(Class type, Closure factoryClosure); + /** * Allows adding DSL extensions to the project. Useful for plugin authors. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index 9c21b95f05814..fab9c86b94984 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -127,8 +127,10 @@ import org.gradle.process.ExecResult; import org.gradle.process.ExecSpec; import org.gradle.process.JavaExecSpec; +import org.gradle.util.Configurable; import org.gradle.util.Path; import org.gradle.util.internal.ClosureBackedAction; +import org.gradle.util.internal.ConfigureUtil; import javax.annotation.Nullable; import javax.inject.Inject; @@ -1150,17 +1152,31 @@ public ProjectInternal project(ProjectInternal referrer, String path, Action) getConfigurations()).configure(configureClosure); + } @Override public void configurations(Action action) { Actions.with(getConfigurations(), action); } + @Override + public void repositories(Closure configureClosure) { + ConfigureUtil.configure(configureClosure, getRepositories()); + } + @Override public void repositories(Action action) { Actions.with(getRepositories(), action); } + @Override + public void dependencies(Closure configureClosure) { + ConfigureUtil.configure(configureClosure, getDependencies()); + } + @Override public void dependencies(Action action) { Actions.with(getDependencies(), action); @@ -1199,6 +1215,11 @@ public Task task(Map options, Object task) { return task(options, task.toString()); } + @Override + public Task task(Map options, String task, Closure configureClosure) { + return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); + } + @Override public Task task(Map options, String name, Action action) { Task task = taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, name))); @@ -1256,6 +1277,7 @@ public NamedDomainObjectContainer container(Class type, NamedDomainObj return getServices().get(DomainObjectCollectionFactory.class).newNamedDomainObjectContainer(type, factory); } + @Override public NamedDomainObjectContainer container(Class type, Closure factoryClosure) { return getServices().get(DomainObjectCollectionFactory.class).newNamedDomainObjectContainer(type, factoryClosure); } diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index f0ce9ac066481..1b6d2a139018a 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -16,6 +16,7 @@ package org.gradle.kotlin.dsl.support.delegates +import groovy.lang.Closure import org.gradle.api.Action import org.gradle.api.AntBuilder import org.gradle.api.NamedDomainObjectContainer @@ -136,6 +137,9 @@ abstract class ProjectDelegate : Project { override fun getProject(): Project = delegate.project + override fun dependencies(configureClosure: Closure<*>) = + delegate.dependencies(configureClosure) + override fun dependencies(action: Action) { delegate.dependencies(action) } @@ -155,6 +159,12 @@ abstract class ProjectDelegate : Project { override fun container(type: Class, factory: NamedDomainObjectFactory): NamedDomainObjectContainer = delegate.container(type, factory) + override fun container(type: Class, factoryClosure: Closure<*>): NamedDomainObjectContainer = + delegate.container(type, factoryClosure) + + override fun repositories(configureClosure: Closure<*>) = + delegate.repositories(configureClosure) + override fun repositories(action: Action) { delegate.repositories(action) } @@ -171,6 +181,9 @@ abstract class ProjectDelegate : Project { override fun sync(action: Action): WorkResult = delegate.sync(action) + override fun configurations(configureClosure: Closure<*>) = + delegate.configurations(configureClosure) + override fun configurations(action: Action) { delegate.configurations(action) } @@ -258,6 +271,9 @@ abstract class ProjectDelegate : Project { override fun task(args: Map, name: String): Task = delegate.task(args, name) + override fun task(args: Map, name: String, configureClosure: Closure<*>): Task = + delegate.task(args, name, configureClosure) + override fun task(args: MutableMap, name: String, action: Action): Task = delegate.task(args, name, action) From 75f3031700c5f8d4b2c93a2347fbf1015b328a40 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 15:18:44 -0400 Subject: [PATCH 34/40] Revert "Add missing Action-taking methods for Project" This reverts commit fbac41c38590ddad75fc96b076ef954673bbe2ff. --- ...ProblemReportingCrossProjectModelAccess.kt | 21 +------ .../src/main/java/org/gradle/api/Project.java | 60 ------------------- .../api/internal/project/DefaultProject.java | 21 ------- .../dsl/support/delegates/ProjectDelegate.kt | 15 ----- 4 files changed, 1 insertion(+), 116 deletions(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index f6f26df3decbf..274b39827a371 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -94,6 +94,7 @@ import org.gradle.process.ExecResult import org.gradle.process.ExecSpec import org.gradle.process.JavaExecSpec import org.gradle.util.Path +import org.gradle.util.internal.ConfigureUtil import java.io.File import java.net.URI import java.util.concurrent.Callable @@ -304,11 +305,6 @@ class ProblemReportingCrossProjectModelAccess( return delegate.task(args, name, configureClosure) } - override fun task(args: MutableMap, name: String, action: Action): Task { - onAccess() - return delegate.task(args, name, action) - } - override fun task(name: String, configureAction: Action): Task { onAccess() return delegate.task(name, configureAction) @@ -490,11 +486,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.configurations(configureClosure) } - override fun configurations(action: Action) { - onAccess() - delegate.configurations(action) - } - override fun getArtifacts(): ArtifactHandler { onAccess() return delegate.artifacts @@ -615,11 +606,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.repositories(configureClosure) } - override fun repositories(action: Action) { - onAccess() - delegate.repositories(action) - } - override fun getDependencies(): DependencyHandler { onAccess() return delegate.dependencies @@ -630,11 +616,6 @@ class ProblemReportingCrossProjectModelAccess( delegate.dependencies(configureClosure) } - override fun dependencies(action: Action) { - onAccess() - delegate.dependencies(action) - } - override fun getDependencyFactory(): DependencyFactory { onAccess() return delegate.dependencyFactory diff --git a/subprojects/core-api/src/main/java/org/gradle/api/Project.java b/subprojects/core-api/src/main/java/org/gradle/api/Project.java index 5b4802d562994..19eeab5efcfef 100644 --- a/subprojects/core-api/src/main/java/org/gradle/api/Project.java +++ b/subprojects/core-api/src/main/java/org/gradle/api/Project.java @@ -506,27 +506,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ Task task(Map args, String name, Closure configureClosure); - /** - *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given - * closure is executed to configure the task. A map of creation options can be passed to this method to control how - * the task is created. See {@link #task(java.util.Map, String)} for the available options.

      - * - *

      After the task is added to the project, it is made available as a property of the project, so that you can - * reference the task by name in your build file. See here for more details

      - * - *

      If a task with the given name already exists in this project and the override option is not set - * to true, an exception is thrown.

      - * - * @param args The task creation options. - * @param name The name of the task to be created - * @param action The action to use to configure the created task. - * @return The newly created task object - * @throws InvalidUserDataException If a task with the given name already exists in this project. - * - * @since 8.0 - */ - Task task(Map args, String name, Action action); - /** *

      Creates a {@link Task} with the given name and adds it to this project. Before the task is returned, the given * action is executed to configure the task.

      After the task is added to the project, it is made @@ -1104,20 +1083,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void configurations(Closure configureClosure); - /** - *

      Configures the dependency configurations for this project. - * - *

      This method executes the given action against the {@link ConfigurationContainer} - * for this project. - * - *

      Examples:

      See docs for {@link ConfigurationContainer} - * - * @param action the action to use to configure the dependency configurations. - * - * @since 8.0 - */ - void configurations(Action action); - /** * Returns a handler for assigning artifacts produced by the project to configurations. *

      Examples:

      See docs for {@link ArtifactHandler} @@ -1362,17 +1327,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void repositories(Closure configureClosure); - /** - *

      Configures the repositories for this project. - * - *

      This method executes the given action against the {@link RepositoryHandler} for this project. - * - * @param action the action to use to configure the repositories. - * - * @since 8.0 - */ - void repositories(Action action); - /** * Returns the dependency handler of this project. The returned dependency handler instance can be used for adding * new dependencies. For accessing already declared dependencies, the configurations can be used. @@ -1398,20 +1352,6 @@ public interface Project extends Comparable, ExtensionAware, PluginAwar */ void dependencies(Closure configureClosure); - /** - *

      Configures the dependencies for this project. - * - *

      This method executes the given action against the {@link DependencyHandler} for this project. - * - *

      Examples:

      - * See docs for {@link DependencyHandler} - * - * @param action the action to use to configure the dependencies. - * - * @since 8.0 - */ - void dependencies(Action action); - /** * Provides access to methods to create various kinds of {@link org.gradle.api.artifacts.Dependency Dependency} instances. * diff --git a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java index fab9c86b94984..e66ae7fbc83a5 100644 --- a/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java +++ b/subprojects/core/src/main/java/org/gradle/api/internal/project/DefaultProject.java @@ -1157,31 +1157,16 @@ public void configurations(Closure configureClosure) { ((Configurable) getConfigurations()).configure(configureClosure); } - @Override - public void configurations(Action action) { - Actions.with(getConfigurations(), action); - } - @Override public void repositories(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getRepositories()); } - @Override - public void repositories(Action action) { - Actions.with(getRepositories(), action); - } - @Override public void dependencies(Closure configureClosure) { ConfigureUtil.configure(configureClosure, getDependencies()); } - @Override - public void dependencies(Action action) { - Actions.with(getDependencies(), action); - } - @Override public void artifacts(Action configureAction) { configureAction.execute(getArtifacts()); @@ -1220,12 +1205,6 @@ public Task task(Map options, String task, Closure configureClosure) { return taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, task))).configure(ConfigureUtil.configureUsing(configureClosure)); } - @Override - public Task task(Map options, String name, Action action) { - Task task = taskContainer.create(addMaps(Cast.uncheckedNonnullCast(options), singletonMap(Task.TASK_NAME, name))); - return Actions.with(task, action); - } - @Inject @Override public abstract ProjectConfigurationActionContainer getConfigurationActions(); diff --git a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt index 1b6d2a139018a..0aeeb03d4bffc 100644 --- a/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt +++ b/subprojects/kotlin-dsl/src/main/kotlin/org/gradle/kotlin/dsl/support/delegates/ProjectDelegate.kt @@ -140,10 +140,6 @@ abstract class ProjectDelegate : Project { override fun dependencies(configureClosure: Closure<*>) = delegate.dependencies(configureClosure) - override fun dependencies(action: Action) { - delegate.dependencies(action) - } - override fun getPath(): String = delegate.path @@ -165,10 +161,6 @@ abstract class ProjectDelegate : Project { override fun repositories(configureClosure: Closure<*>) = delegate.repositories(configureClosure) - override fun repositories(action: Action) { - delegate.repositories(action) - } - override fun evaluationDependsOnChildren() = delegate.evaluationDependsOnChildren() @@ -184,10 +176,6 @@ abstract class ProjectDelegate : Project { override fun configurations(configureClosure: Closure<*>) = delegate.configurations(configureClosure) - override fun configurations(action: Action) { - delegate.configurations(action) - } - override fun getExtensions(): ExtensionContainer = delegate.extensions @@ -274,9 +262,6 @@ abstract class ProjectDelegate : Project { override fun task(args: Map, name: String, configureClosure: Closure<*>): Task = delegate.task(args, name, configureClosure) - override fun task(args: MutableMap, name: String, action: Action): Task = - delegate.task(args, name, action) - override fun task(name: String, configureAction: Action): Task = delegate.task(name, configureAction) From 51b8016f489c74d9827974598c7507844a176dc5 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 15:53:33 -0400 Subject: [PATCH 35/40] Make ktlint happy --- .../ProblemReportingCrossProjectModelAccess.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt index 274b39827a371..445b9e57a429d 100644 --- a/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt +++ b/subprojects/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ProblemReportingCrossProjectModelAccess.kt @@ -94,7 +94,6 @@ import org.gradle.process.ExecResult import org.gradle.process.ExecSpec import org.gradle.process.JavaExecSpec import org.gradle.util.Path -import org.gradle.util.internal.ConfigureUtil import java.io.File import java.net.URI import java.util.concurrent.Callable From 5bc02cc50b7f243f906d6043deec4b2de22be0c5 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 16:11:25 -0400 Subject: [PATCH 36/40] Ignore compatibility checks so we can run some tests --- .../src/main/groovy/gradlebuild.binary-compatibility.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build-logic/binary-compatibility/src/main/groovy/gradlebuild.binary-compatibility.gradle b/build-logic/binary-compatibility/src/main/groovy/gradlebuild.binary-compatibility.gradle index 2367b0a10a3b8..96d2be079e508 100644 --- a/build-logic/binary-compatibility/src/main/groovy/gradlebuild.binary-compatibility.gradle +++ b/build-logic/binary-compatibility/src/main/groovy/gradlebuild.binary-compatibility.gradle @@ -106,6 +106,7 @@ dependencies { } def checkBinaryCompatibility = tasks.register("checkBinaryCompatibility", JapicmpTask) { + enabled = false def baseVersion = moduleIdentity.version.map { it.baseVersion.version } def isSnapshot = moduleIdentity.snapshot inputs.property('acceptedViolations', acceptedViolations.toAcceptedChangesMap()) From 42024616ef64c3eaf72ffb73aae820b285d03fdb Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 16:42:16 -0400 Subject: [PATCH 37/40] Remove Closure methods from DeploymentDescriptor --- .../ear/descriptor/DeploymentDescriptor.java | 14 -------------- .../internal/DefaultDeploymentDescriptor.java | 7 ------- 2 files changed, 21 deletions(-) diff --git a/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/DeploymentDescriptor.java b/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/DeploymentDescriptor.java index 83385bbb4b294..245a42c64e91c 100644 --- a/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/DeploymentDescriptor.java +++ b/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/DeploymentDescriptor.java @@ -15,8 +15,6 @@ */ package org.gradle.plugins.ear.descriptor; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.XmlProvider; @@ -164,18 +162,6 @@ public interface DeploymentDescriptor { void setModuleTypeMappings(Map moduleTypeMappings); - /** - * Adds a closure to be called when the XML document has been created. The XML is passed to the closure as a - * parameter in form of a {@link groovy.util.Node}. The closure can modify the XML before it is written to the - * output file. This allows additional JavaEE version 6 elements like "data-source" or "resource-ref" to be - * included. - * - * @param closure - * The closure to execute when the XML has been created - * @return this - */ - DeploymentDescriptor withXml(@DelegatesTo(XmlProvider.class) Closure closure); - /** * Adds an action to be called when the XML document has been created. The XML is passed to the action as a * parameter in form of a {@link groovy.util.Node}. The action can modify the XML before it is written to the output diff --git a/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/internal/DefaultDeploymentDescriptor.java b/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/internal/DefaultDeploymentDescriptor.java index fe503f2dd8eef..d180b94b96435 100644 --- a/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/internal/DefaultDeploymentDescriptor.java +++ b/subprojects/ear/src/main/java/org/gradle/plugins/ear/descriptor/internal/DefaultDeploymentDescriptor.java @@ -15,7 +15,6 @@ */ package org.gradle.plugins.ear.descriptor.internal; -import groovy.lang.Closure; import groovy.namespace.QName; import groovy.util.Node; import groovy.xml.XmlParser; @@ -215,12 +214,6 @@ public DeploymentDescriptor securityRole(Action action) return this; } - @Override - public DeploymentDescriptor withXml(Closure closure) { - transformer.addAction(closure); - return this; - } - @Override public DeploymentDescriptor withXml(Action action) { transformer.addAction(action); From 6665e090bc7a0eb6d5098f1c6385a57e45607432 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 16:54:51 -0400 Subject: [PATCH 38/40] Remove Closure from IDE related types --- .../gradle/internal/xml/XmlTransformer.java | 7 ---- .../plugins/ide/api/FileContentMerger.java | 34 ---------------- .../ide/api/PropertiesFileContentMerger.java | 17 +------- .../plugins/ide/api/XmlFileContentMerger.java | 19 ++------- .../plugins/ide/eclipse/EclipsePlugin.java | 2 +- .../ide/eclipse/model/EclipseClasspath.java | 14 ------- .../plugins/ide/eclipse/model/EclipseJdt.java | 17 -------- .../ide/eclipse/model/EclipseModel.java | 40 ------------------- .../ide/eclipse/model/EclipseProject.java | 27 ------------- .../plugins/ide/eclipse/model/EclipseWtp.java | 22 ---------- .../eclipse/model/EclipseWtpComponent.java | 16 -------- .../ide/eclipse/model/EclipseWtpFacet.java | 18 --------- .../gradle/plugins/ide/idea/IdeaPlugin.java | 2 +- .../plugins/ide/idea/model/IdeaModel.java | 25 ------------ .../plugins/ide/idea/model/IdeaModule.java | 13 ------ .../plugins/ide/idea/model/IdeaModuleIml.java | 2 + .../plugins/ide/idea/model/IdeaProject.java | 14 ------- .../plugins/ide/idea/model/IdeaWorkspace.java | 13 ------ 18 files changed, 9 insertions(+), 293 deletions(-) diff --git a/subprojects/core/src/main/java/org/gradle/internal/xml/XmlTransformer.java b/subprojects/core/src/main/java/org/gradle/internal/xml/XmlTransformer.java index cad993e7bfb7c..0533e11511c44 100644 --- a/subprojects/core/src/main/java/org/gradle/internal/xml/XmlTransformer.java +++ b/subprojects/core/src/main/java/org/gradle/internal/xml/XmlTransformer.java @@ -16,8 +16,6 @@ package org.gradle.internal.xml; import com.google.common.collect.Lists; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import groovy.util.IndentPrinter; import groovy.util.Node; import groovy.xml.XmlNodePrinter; @@ -30,7 +28,6 @@ import org.gradle.internal.IoActions; import org.gradle.internal.SystemProperties; import org.gradle.internal.UncheckedException; -import org.gradle.util.internal.ConfigureUtil; import org.gradle.util.internal.GUtil; import org.gradle.util.internal.TextUtil; import org.w3c.dom.Document; @@ -73,10 +70,6 @@ public void setIndentation(String indentation) { this.indentation = indentation; } - public void addAction(@DelegatesTo(XmlProvider.class) Closure closure) { - actions.add(ConfigureUtil.configureUsing(closure)); - } - public void transform(File destination, final String encoding, final Action generator) { IoActions.writeTextFile(destination, encoding, new Action() { @Override diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/FileContentMerger.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/FileContentMerger.java index c275f47a3e36e..1bc2a197b4a90 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/FileContentMerger.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/FileContentMerger.java @@ -15,10 +15,8 @@ */ package org.gradle.plugins.ide.api; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.internal.MutableActionSet; -import org.gradle.util.internal.ConfigureUtil; /** * Models the generation/parsing/merging capabilities. @@ -79,36 +77,4 @@ public void beforeMerged(Action action) { public void whenMerged(Action action) { whenMerged.add(action); } - - /** - * Adds a closure to be called after content is loaded from existing file but before gradle build information is merged. - *

      - * This is advanced api that gives access to internal implementation. - * It might be useful if you want to alter the way gradle build information is merged into existing file content. - *

      - * For examples see docs for {@link org.gradle.plugins.ide.eclipse.model.EclipseProject} - * or {@link org.gradle.plugins.ide.idea.model.IdeaProject} and others. - * - * @param closure The closure to execute. - */ - @SuppressWarnings("unchecked") - public void beforeMerged(Closure closure) { - beforeMerged.add(ConfigureUtil.configureUsing(closure)); - } - - /** - * Adds a closure to be called after content is loaded from existing file and after gradle build information is merged. - *

      - * This is advanced api that gives access to internal implementation of idea plugin. - * Use it only to tackle some tricky edge cases. - *

      - * For examples see docs for {@link org.gradle.plugins.ide.eclipse.model.EclipseProject} - * or {@link org.gradle.plugins.ide.idea.model.IdeaProject} and others. - * - * @param closure The closure to execute. - */ - @SuppressWarnings("unchecked") - public void whenMerged(Closure closure) { - whenMerged.add(ConfigureUtil.configureUsing(closure)); - } } diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/PropertiesFileContentMerger.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/PropertiesFileContentMerger.java index 1bfcee7bf788e..593c6af665c19 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/PropertiesFileContentMerger.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/PropertiesFileContentMerger.java @@ -15,11 +15,10 @@ */ package org.gradle.plugins.ide.api; -import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.internal.PropertiesTransformer; -import org.gradle.util.internal.ClosureBackedAction; +import javax.inject.Inject; import java.util.Properties; /** @@ -32,6 +31,7 @@ public class PropertiesFileContentMerger extends FileContentMerger { private PropertiesTransformer transformer; + @Inject public PropertiesFileContentMerger(PropertiesTransformer transformer) { this.transformer = transformer; } @@ -44,19 +44,6 @@ public void setTransformer(PropertiesTransformer transformer) { this.transformer = transformer; } - /** - * Adds a closure to be called when the file has been created. - * The {@link Properties} are passed to the closure as a parameter. - * The closure can modify the Properties before they are written to the output file. - *

      - * For examples see docs for {@link org.gradle.plugins.ide.eclipse.model.EclipseJdt} and others. - * - * @param closure The closure to execute when the Properties have been created. - */ - public void withProperties(Closure closure) { - withProperties(new ClosureBackedAction(closure, Closure.OWNER_FIRST)); - } - /** * Adds an action to be called when the file has been created. * The {@link Properties} are passed to the action as a parameter. diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/XmlFileContentMerger.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/XmlFileContentMerger.java index f2c1e6098d962..b1f564d5cdbad 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/XmlFileContentMerger.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/api/XmlFileContentMerger.java @@ -15,8 +15,6 @@ */ package org.gradle.plugins.ide.api; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.XmlProvider; import org.gradle.internal.xml.XmlTransformer; @@ -45,24 +43,13 @@ public void setXmlTransformer(XmlTransformer xmlTransformer) { } /** - * Adds a closure to be called when the file has been created. - * The XML is passed to the closure as a parameter in form of a {@link XmlProvider}. - * The closure can modify the XML before it is written to the output file. + * Adds an action to be called when the file has been created. + *

      + * The action can modify the XML before it is written to the output file. *

      * For examples see docs for {@link org.gradle.plugins.ide.eclipse.model.EclipseProject} * or {@link org.gradle.plugins.ide.idea.model.IdeaProject} and others. * - * @param closure The closure to execute when the XML has been created. - */ - public void withXml(@DelegatesTo(XmlProvider.class) Closure closure) { - xmlTransformer.addAction(closure); - } - - /** - * Adds an action to be called when the file has been created. - *

      - * See {@link #withXml(Closure)} - * * @param action The action to execute when the XML has been created. */ public void withXml(Action action) { diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/EclipsePlugin.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/EclipsePlugin.java index 9be64762d7bde..a5a77d13c3181 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/EclipsePlugin.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/EclipsePlugin.java @@ -389,7 +389,7 @@ private void configureEclipseJdt(final Project project, final EclipseModel model project.getPlugins().withType(JavaBasePlugin.class, new Action() { @Override public void execute(JavaBasePlugin javaBasePlugin) { - model.setJdt(project.getObjects().newInstance(EclipseJdt.class, new PropertiesFileContentMerger(new PropertiesTransformer()))); + model.setJdt(project.getObjects().newInstance(EclipseJdt.class, project.getObjects().newInstance(PropertiesFileContentMerger.class, new PropertiesTransformer()))); final TaskProvider task = project.getTasks().register(ECLIPSE_JDT_TASK_NAME, GenerateEclipseJdt.class, model.getJdt()); task.configure(new Action() { @Override diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseClasspath.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseClasspath.java index 4f39e7c976140..71b15f4470733 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseClasspath.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseClasspath.java @@ -17,8 +17,6 @@ package org.gradle.plugins.ide.eclipse.model; import com.google.common.base.Preconditions; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Incubating; import org.gradle.api.Task; @@ -38,7 +36,6 @@ import org.gradle.plugins.ide.eclipse.model.internal.FileReferenceFactory; import org.gradle.plugins.ide.internal.IdeArtifactRegistry; import org.gradle.plugins.ide.internal.resolver.DefaultGradleApiSourcesResolver; -import org.gradle.util.internal.ConfigureUtil; import javax.inject.Inject; import java.io.File; @@ -322,17 +319,6 @@ public void containers(String... containers) { this.containers.addAll(Arrays.asList(containers)); } - /** - * Enables advanced configuration like tinkering with the output XML or affecting the way - * that the contents of an existing .classpath file is merged with Gradle build information. - * The object passed to the whenMerged{} and beforeMerged{} closures is of type {@link Classpath}. - *

      - * See {@link EclipseProject} for an example. - */ - public void file(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - ConfigureUtil.configure(closure, file); - } - /** * Enables advanced configuration like tinkering with the output XML or affecting the way * that the contents of an existing .classpath file is merged with Gradle build information. diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseJdt.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseJdt.java index b7c93f629f5f4..f0e91cedb72eb 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseJdt.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseJdt.java @@ -16,12 +16,9 @@ package org.gradle.plugins.ide.eclipse.model; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.JavaVersion; import org.gradle.plugins.ide.api.PropertiesFileContentMerger; -import org.gradle.util.internal.ConfigureUtil; import javax.inject.Inject; @@ -147,20 +144,6 @@ public PropertiesFileContentMerger getFile() { return file; } - /** - * Enables advanced configuration like affecting the way existing jdt file content - * is merged with gradle build information - *

      - * The object passed to whenMerged{} and beforeMerged{} closures is of type {@link Jdt} - *

      - * The object passed to withProperties{} closures is of type {@link java.util.Properties} - *

      - * For example see docs for {@link EclipseJdt} - */ - public void file(@DelegatesTo(PropertiesFileContentMerger.class) Closure closure) { - ConfigureUtil.configure(closure, file); - } - /** * Enables advanced configuration like affecting the way existing jdt file content * is merged with gradle build information diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseModel.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseModel.java index 3f7bf76efdc14..5dafa6491d47c 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseModel.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseModel.java @@ -17,8 +17,6 @@ package org.gradle.plugins.ide.eclipse.model; import com.google.common.base.Preconditions; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Project; import org.gradle.api.internal.project.ProjectInternal; @@ -32,8 +30,6 @@ import java.io.File; import java.util.Map; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * DSL-friendly model of the Eclipse project information. * First point of entry for customizing Eclipse project generation. @@ -163,15 +159,6 @@ public void setWtp(EclipseWtp wtp) { this.wtp = wtp; } - /** - * Configures eclipse project information - *

      - * For examples see docs for {@link EclipseProject} - */ - public void project(@DelegatesTo(EclipseProject.class) Closure closure) { - configure(closure, getProject()); - } - /** * Configures eclipse project information *

      @@ -183,15 +170,6 @@ public void project(Action action) { action.execute(getProject()); } - /** - * Configures eclipse classpath information - *

      - * For examples see docs for {@link EclipseClasspath} - */ - public void classpath(@DelegatesTo(EclipseClasspath.class) Closure closure) { - configure(closure, classpath); - } - /** * Configures eclipse classpath information *

      @@ -203,15 +181,6 @@ public void classpath(Action action) { action.execute(classpath); } - /** - * Configures eclipse wtp information - *

      - * For examples see docs for {@link EclipseWtp} - */ - public void wtp(@DelegatesTo(EclipseWtp.class) Closure closure) { - configure(closure, wtp); - } - /** * Configures eclipse wtp information *

      @@ -223,15 +192,6 @@ public void wtp(Action action) { action.execute(wtp); } - /** - * Configures eclipse java compatibility information (jdt) - *

      - * For examples see docs for {@link EclipseProject} - */ - public void jdt(@DelegatesTo(EclipseJdt.class) Closure closure) { - configure(closure, getJdt()); - } - /** * Configures eclipse java compatibility information (jdt) *

      diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseProject.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseProject.java index f2aa7d53e51b1..ab3981ababa58 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseProject.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseProject.java @@ -18,13 +18,10 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.InvalidUserDataException; import org.gradle.plugins.ide.api.XmlFileContentMerger; import org.gradle.plugins.ide.eclipse.model.internal.DefaultResourceFilter; -import org.gradle.util.internal.ClosureBackedAction; import javax.inject.Inject; import java.util.Arrays; @@ -32,8 +29,6 @@ import java.util.Map; import java.util.Set; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning project details (.project file) of the Eclipse plugin *

      @@ -316,18 +311,6 @@ public Set getResourceFilters() { return resourceFilters; } - /** - * Adds a resource filter to the eclipse project. - *

      - * For examples, see docs for {@link ResourceFilter} - * - * @param configureClosure The closure to use to configure the resource filter. - * @since 3.5 - */ - public ResourceFilter resourceFilter(@DelegatesTo(value=ResourceFilter.class, strategy = Closure.DELEGATE_FIRST) Closure configureClosure) { - return resourceFilter(new ClosureBackedAction(configureClosure)); - } - /** * Adds a resource filter to the eclipse project. *

      @@ -343,16 +326,6 @@ public ResourceFilter resourceFilter(Action configureAct return f; } - /** - * Enables advanced configuration like tinkering with the output XML or affecting the way existing .project content is merged with gradle build information

      The object passed to whenMerged{} - * and beforeMerged{} closures is of type {@link Project}

      - * - * For example see docs for {@link EclipseProject} - */ - public void file(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - configure(closure, file); - } - /** * Enables advanced configuration like tinkering with the output XML or affecting the way existing .project content is merged with gradle build information. * diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtp.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtp.java index a7f8f02f20f0b..a323a2d2ef450 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtp.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtp.java @@ -15,8 +15,6 @@ */ package org.gradle.plugins.ide.eclipse.model; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.model.ObjectFactory; import org.gradle.internal.xml.XmlTransformer; @@ -24,8 +22,6 @@ import javax.inject.Inject; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning wtp/wst details of the Eclipse plugin *

      @@ -84,15 +80,6 @@ public void setComponent(EclipseWtpComponent component) { this.component = component; } - /** - * Configures wtp component. - *

      - * For examples see docs for {@link EclipseWtpComponent} - */ - public void component(@DelegatesTo(EclipseWtpComponent.class) Closure action) { - configure(action, component); - } - /** * Configures wtp component. *

      @@ -122,15 +109,6 @@ public void setFacet(EclipseWtpFacet facet) { this.facet = facet; } - /** - * Configures wtp facet. - *

      - * For examples see docs for {@link EclipseWtpFacet} - */ - public void facet(@DelegatesTo(EclipseWtpFacet.class) Closure action) { - configure(action, getFacet()); - } - /** * Configures wtp facet. *

      diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpComponent.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpComponent.java index 4b764551b9233..b60e4e5e3041c 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpComponent.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpComponent.java @@ -19,8 +19,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; @@ -38,8 +36,6 @@ import java.util.Map; import java.util.Set; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning wtp component details of the Eclipse plugin *

      @@ -170,18 +166,6 @@ public XmlFileContentMerger getFile() { return file; } - /** - * Enables advanced configuration like tinkering with the output XML - * or affecting the way existing wtp component file content is merged with gradle build information - *

      - * The object passed to whenMerged{} and beforeMerged{} closures is of type {@link WtpComponent} - *

      - * For example see docs for {@link EclipseWtpComponent} - */ - public void file(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - configure(closure, file); - } - /** * Enables advanced configuration like tinkering with the output XML * or affecting the way existing wtp component file content is merged with gradle build information. diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpFacet.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpFacet.java index f7a88e75a1f30..70a2a3eb07b89 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpFacet.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/eclipse/model/EclipseWtpFacet.java @@ -17,14 +17,11 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.plugins.ide.api.XmlFileContentMerger; import org.gradle.util.internal.ConfigureUtil; import javax.inject.Inject; - import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -32,8 +29,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning wtp facet details of the Eclipse plugin *

      @@ -96,19 +91,6 @@ public XmlFileContentMerger getFile() { return file; } - /** - * Enables advanced configuration like tinkering with the output XML - * or affecting the way existing wtp facet file content is merged with gradle build information - *

      - * The object passed to whenMerged{} and beforeMerged{} closures is of type {@link WtpFacet} - *

      - * - * For example see docs for {@link EclipseWtpFacet} - */ - public void file(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - configure(closure, file); - } - /** * Enables advanced configuration like tinkering with the output XML * or affecting the way existing wtp facet file content is merged with gradle build information. diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/IdeaPlugin.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/IdeaPlugin.java index 4e4037a9425f9..ce96c239cddab 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/IdeaPlugin.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/IdeaPlugin.java @@ -254,7 +254,7 @@ private List getAllJavaProjects() { } private void configureIdeaModule(final ProjectInternal project) { - IdeaModuleIml iml = new IdeaModuleIml(new XmlTransformer(), project.getProjectDir()); + IdeaModuleIml iml = project.getObjects().newInstance(IdeaModuleIml.class, new XmlTransformer(), project.getProjectDir()); final IdeaModule module = instantiator.newInstance(IdeaModule.class, project, iml); final TaskProvider task = project.getTasks().register(IDEA_MODULE_TASK_NAME, GenerateIdeaModule.class, module); diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModel.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModel.java index c3aa6c1d37368..173a3c7474e41 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModel.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModel.java @@ -16,15 +16,11 @@ package org.gradle.plugins.ide.idea.model; import com.google.common.base.Preconditions; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import java.io.File; import java.util.Map; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * DSL-friendly model of the IDEA project information. * First point of entry when it comes to customizing the IDEA generation. @@ -84,13 +80,6 @@ public void setTargetVersion(String targetVersion) { this.targetVersion = targetVersion; } - /** - * Configures IDEA module information.

      For examples see docs for {@link IdeaModule}. - */ - public void module(@DelegatesTo(IdeaModule.class) Closure closure) { - configure(closure, getModule()); - } - /** * Configures IDEA module information.

      For examples see docs for {@link IdeaModule}. * @since 3.5 @@ -99,13 +88,6 @@ public void module(Action action) { action.execute(getModule()); } - /** - * Configures IDEA project information.

      For examples see docs for {@link IdeaProject}. - */ - public void project(@DelegatesTo(IdeaProject.class) Closure closure) { - configure(closure, getProject()); - } - /** * Configures IDEA project information.

      For examples see docs for {@link IdeaProject}. * @since 3.5 @@ -114,13 +96,6 @@ public void project(Action action) { action.execute(getProject()); } - /** - * Configures IDEA workspace information.

      For examples see docs for {@link IdeaWorkspace}. - */ - public void workspace(@DelegatesTo(IdeaWorkspace.class) Closure closure) { - configure(closure, getWorkspace()); - } - /** * Configures IDEA workspace information.

      For examples see docs for {@link IdeaWorkspace}. * @since 3.5 diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModule.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModule.java index c86d31c67906d..2daa6b481c25b 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModule.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModule.java @@ -18,8 +18,6 @@ import com.google.common.base.Predicate; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.JavaVersion; import org.gradle.api.Project; @@ -37,8 +35,6 @@ import java.util.Set; import java.util.stream.Collectors; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning module details (*.iml file) of the IDEA plugin. *

      @@ -511,15 +507,6 @@ public void setSingleEntryLibraries(Map> singleEntryLibra this.singleEntryLibraries = singleEntryLibraries; } - /** - * Enables advanced configuration like tinkering with the output XML or affecting the way existing *.iml content is merged with gradle build information. - *

      - * For example see docs for {@link IdeaModule}. - */ - public void iml(@DelegatesTo(IdeaModuleIml.class) Closure closure) { - configure(closure, getIml()); - } - /** * Enables advanced configuration like tinkering with the output XML or affecting the way existing *.iml content is merged with gradle build information. *

      diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModuleIml.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModuleIml.java index 7f88b81098af9..f0695876f5c9c 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModuleIml.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaModuleIml.java @@ -18,6 +18,7 @@ import org.gradle.internal.xml.XmlTransformer; import org.gradle.plugins.ide.api.XmlFileContentMerger; +import javax.inject.Inject; import java.io.File; /** @@ -29,6 +30,7 @@ public class IdeaModuleIml extends XmlFileContentMerger { private File generateTo; + @Inject public IdeaModuleIml(XmlTransformer xmlTransformer, File generateTo) { super(xmlTransformer); this.generateTo = generateTo; diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaProject.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaProject.java index a0098e255faeb..1b364e9895101 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaProject.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaProject.java @@ -16,8 +16,6 @@ package org.gradle.plugins.ide.idea.model; import com.google.common.collect.Sets; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.JavaVersion; import org.gradle.api.artifacts.component.BuildIdentifier; @@ -37,8 +35,6 @@ import java.util.List; import java.util.Set; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning project details (*.ipr file) of the IDEA plugin. *

      @@ -168,16 +164,6 @@ public XmlFileContentMerger getIpr() { return ipr; } - /** - * Enables advanced configuration like tinkering with the output XML - * or affecting the way existing *.ipr content is merged with Gradle build information. - *

      - * See the examples in the docs for {@link IdeaProject} - */ - public void ipr(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - configure(closure, ipr); - } - /** * Enables advanced configuration like tinkering with the output XML * or affecting the way existing *.ipr content is merged with Gradle build information. diff --git a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaWorkspace.java b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaWorkspace.java index 573f267d63790..58733c467008f 100644 --- a/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaWorkspace.java +++ b/subprojects/ide/src/main/java/org/gradle/plugins/ide/idea/model/IdeaWorkspace.java @@ -15,13 +15,9 @@ */ package org.gradle.plugins.ide.idea.model; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.plugins.ide.api.XmlFileContentMerger; -import static org.gradle.util.internal.ConfigureUtil.configure; - /** * Enables fine-tuning workspace details (*.iws file) of the IDEA plugin. *

      @@ -55,15 +51,6 @@ public void setIws(XmlFileContentMerger iws) { this.iws = iws; } - /** - * Enables advanced manipulation of the output XML. - *

      - * For example see docs for {@link IdeaWorkspace} - */ - public void iws(@DelegatesTo(XmlFileContentMerger.class) Closure closure) { - configure(closure, iws); - } - /** * Enables advanced manipulation of the output XML. *

      From bc50fbf270dcfd1617c90e779190616694f99623 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Sun, 25 Sep 2022 16:58:33 -0400 Subject: [PATCH 39/40] Remove Closure methods from Jar and War --- .../main/java/org/gradle/jvm/tasks/Jar.java | 28 ------------------- .../org/gradle/api/tasks/bundling/Jar.java | 6 ---- .../org/gradle/api/tasks/bundling/War.java | 15 ---------- 3 files changed, 49 deletions(-) diff --git a/subprojects/platform-jvm/src/main/java/org/gradle/jvm/tasks/Jar.java b/subprojects/platform-jvm/src/main/java/org/gradle/jvm/tasks/Jar.java index 09999674a5e81..6135ed01afce4 100644 --- a/subprojects/platform-jvm/src/main/java/org/gradle/jvm/tasks/Jar.java +++ b/subprojects/platform-jvm/src/main/java/org/gradle/jvm/tasks/Jar.java @@ -17,8 +17,6 @@ package org.gradle.jvm.tasks; import com.google.common.collect.ImmutableList; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.InvalidUserDataException; import org.gradle.api.file.CopySpec; @@ -36,7 +34,6 @@ import org.gradle.api.tasks.bundling.Zip; import org.gradle.internal.execution.OutputChangeListener; import org.gradle.internal.serialization.Cached; -import org.gradle.util.internal.ConfigureUtil; import org.gradle.work.DisableCachingByDefault; import java.nio.charset.Charset; @@ -174,19 +171,6 @@ public void setManifest(Manifest manifest) { this.manifest = manifest; } - /** - * Configures the manifest for this JAR archive. - * - *

      The given closure is executed to configure the manifest. The {@link org.gradle.api.java.archives.Manifest} is passed to the closure as its delegate.

      - * - * @param configureClosure The closure. - * @return This. - */ - public Jar manifest(@DelegatesTo(Manifest.class) Closure configureClosure) { - ConfigureUtil.configure(configureClosure, forceManifest()); - return this; - } - /** * Configures the manifest for this JAR archive. * @@ -213,18 +197,6 @@ public CopySpec getMetaInf() { return metaInf.addChild(); } - /** - * Adds content to this JAR archive's META-INF directory. - * - *

      The given closure is executed to configure a {@code CopySpec}. The {@link org.gradle.api.file.CopySpec} is passed to the closure as its delegate.

      - * - * @param configureClosure The closure. - * @return The created {@code CopySpec} - */ - public CopySpec metaInf(@DelegatesTo(CopySpec.class) Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, getMetaInf()); - } - /** * Adds content to this JAR archive's META-INF directory. * diff --git a/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/Jar.java b/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/Jar.java index f5c7a42804ea4..4cacf1eaed56a 100644 --- a/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/Jar.java +++ b/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/Jar.java @@ -16,7 +16,6 @@ package org.gradle.api.tasks.bundling; -import groovy.lang.Closure; import org.gradle.work.DisableCachingByDefault; /** @@ -24,10 +23,5 @@ */ @DisableCachingByDefault(because = "Not worth caching") public class Jar extends org.gradle.jvm.tasks.Jar { - @Override - public Jar manifest(Closure configureClosure) { - super.manifest(configureClosure); - return this; - } } diff --git a/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/War.java b/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/War.java index a40d65e0e767a..5eb865922258d 100644 --- a/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/War.java +++ b/subprojects/plugins/src/main/java/org/gradle/api/tasks/bundling/War.java @@ -15,8 +15,6 @@ */ package org.gradle.api.tasks.bundling; -import groovy.lang.Closure; -import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.file.CopySpec; import org.gradle.api.file.DirectoryProperty; @@ -32,7 +30,6 @@ import org.gradle.api.tasks.PathSensitive; import org.gradle.api.tasks.PathSensitivity; import org.gradle.internal.Transformers; -import org.gradle.util.internal.ConfigureUtil; import org.gradle.work.DisableCachingByDefault; import javax.annotation.Nullable; @@ -89,18 +86,6 @@ public CopySpec getWebInf() { return webInf.addChild(); } - /** - * Adds some content to the {@code WEB-INF} directory for this WAR archive. - * - *

      The given closure is executed to configure a {@link CopySpec}. The {@code CopySpec} is passed to the closure as its delegate. - * - * @param configureClosure The closure to execute - * @return The newly created {@code CopySpec}. - */ - public CopySpec webInf(@DelegatesTo(CopySpec.class) Closure configureClosure) { - return ConfigureUtil.configure(configureClosure, getWebInf()); - } - /** * Adds some content to the {@code WEB-INF} directory for this WAR archive. * From 816450421eb2cdc4878f22867aa7fe100eb3abaa Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Tue, 11 Oct 2022 08:57:07 -0400 Subject: [PATCH 40/40] Add test for Closure-taking methods with CompileStatic --- ...ClosureTakingMethodsIntegrationTest.groovy | 119 ++++++++++++++++++ .../gradle/test/fixtures/file/TestFile.java | 4 + 2 files changed, 123 insertions(+) create mode 100644 subprojects/core/src/integTest/groovy/org/gradle/groovy/scripts/ClosureTakingMethodsIntegrationTest.groovy diff --git a/subprojects/core/src/integTest/groovy/org/gradle/groovy/scripts/ClosureTakingMethodsIntegrationTest.groovy b/subprojects/core/src/integTest/groovy/org/gradle/groovy/scripts/ClosureTakingMethodsIntegrationTest.groovy new file mode 100644 index 0000000000000..8ca9fa5532893 --- /dev/null +++ b/subprojects/core/src/integTest/groovy/org/gradle/groovy/scripts/ClosureTakingMethodsIntegrationTest.groovy @@ -0,0 +1,119 @@ +/* + * Copyright 2022 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.groovy.scripts + +import groovy.test.NotYetImplemented +import org.gradle.integtests.fixtures.AbstractIntegrationSpec + +class ClosureTakingMethodsIntegrationTest extends AbstractIntegrationSpec { + @NotYetImplemented + def 'can use Action-taking methods in place of Closures with @CompileStatic'() { + def myPlugin = file("buildSrc/src/main/groovy/com/example/MyPlugin.groovy") + myPlugin.groovy """ +package com.example + +import groovy.transform.CompileStatic + +import org.gradle.api.Action +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.util.internal.ConfigureUtil + +import javax.inject.Inject + +@CompileStatic +abstract class MyPlugin implements Plugin { + @Override + void apply(Project project) { + MyExt myext = project.extensions.create("myext", MyExt, project) + myext.method { + assert it instanceof Project + description = "Set from plugin" + } + } +} + +@CompileStatic +abstract class MyExt { + public String sensed = null + + private final Project project + + @Inject + MyExt(Project project) { + this.project = project + } + + void method(@DelegatesTo(Project.class) Closure closure) { + method(ConfigureUtil.configureUsing(closure)) + sensed = "closure" + } + + void method(Action action) { + action.execute(project) + sensed = "action" + } +} +""" + file("buildSrc/build.gradle") << """ +plugins { + id 'groovy-gradle-plugin' +} + +gradlePlugin { + plugins { + myPlugin { + id = 'com.example.myPlugin' + implementationClass = 'com.example.MyPlugin' + } + } +} +""" + + buildFile << """ +plugins { + id 'com.example.myPlugin' +} + +assert description == "Set from plugin" +assert myext.sensed == "closure" +""" + when: + succeeds("help") + then: + noExceptionThrown() + + when: + // Remove closure taking method + myPlugin.replace(""" + void method(@DelegatesTo(Project.class) Closure closure) { + method(ConfigureUtil.configureUsing(closure)) + sensed = "closure" + } +""", "") + buildFile << """ +plugins { + id 'com.example.myPlugin' +} + +assert description == "Set from plugin" +assert myext.sensed == "action" +""" + then: + succeeds("help") + } +} diff --git a/subprojects/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/TestFile.java b/subprojects/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/TestFile.java index c503065b3fbd2..f6a2f668f7b57 100644 --- a/subprojects/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/TestFile.java +++ b/subprojects/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/TestFile.java @@ -100,6 +100,10 @@ public TestFile java(@Language("java") String src) { return setText(src); } + public TestFile groovy(@Language("groovy") String src) { + Assert.assertTrue(getName() + " doesn't look like a Groovy file.", getName().endsWith(".groovy")); + return setText(src); + } Object writeReplace() throws ObjectStreamException { return new File(getAbsolutePath()); }