From 7209e7126da7b082b82f1376545d2371cc7b783f Mon Sep 17 00:00:00 2001 From: Josh Feinberg Date: Thu, 7 Jul 2022 14:34:52 -0500 Subject: [PATCH 1/3] Upgrade Gradle Plugin so we can have knowledge of how to disable config cache --- .../affectedmoduledetector/AffectedModuleDetectorPlugin.kt | 5 +++++ gradle/wrapper/gradle-wrapper.properties | 2 +- sample/gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt index 62630c3a..8db99fac 100644 --- a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt @@ -9,6 +9,7 @@ import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.testing.Test import org.gradle.internal.impldep.org.jetbrains.annotations.VisibleForTesting +import org.gradle.util.GradleVersion /** * This plugin creates and registers all affected test tasks. @@ -125,6 +126,7 @@ class AffectedModuleDetectorPlugin : Plugin { ) } + @Suppress("UnstableApiUsage") @VisibleForTesting internal fun registerInternalTask( rootProject: Project, @@ -134,6 +136,9 @@ class AffectedModuleDetectorPlugin : Plugin { val task = rootProject.tasks.register(taskType.commandByImpact).get() task.group = groupName task.description = taskType.taskDescription + if (GradleVersion.current() >= GradleVersion.version("7.4")) { + task.notCompatibleWithConfigurationCache("AMD requires knowledge of what has changed in the file system so we can not cache those values (https://github.com/dropbox/AffectedModuleDetector/issues/150)") + } rootProject.subprojects { project -> project.afterEvaluate { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0ffc7e4..0c37a082 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-4-bin.zip diff --git a/sample/gradle/wrapper/gradle-wrapper.properties b/sample/gradle/wrapper/gradle-wrapper.properties index ad9e0cbe..53450a8a 100644 --- a/sample/gradle/wrapper/gradle-wrapper.properties +++ b/sample/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip From 7f9c1db6544a6508ce9026b7658623ec73fcc2ee Mon Sep 17 00:00:00 2001 From: Josh Feinberg Date: Thu, 7 Jul 2022 14:36:25 -0500 Subject: [PATCH 2/3] Get off RC --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c37a082..b61ec111 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip From 9c5040e1c17768f62cc8adf27e9580f168c411b6 Mon Sep 17 00:00:00 2001 From: Josh Feinberg Date: Fri, 15 Jul 2022 13:21:55 -0500 Subject: [PATCH 3/3] PR Comments --- .../AffectedModuleDetectorPlugin.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt index 8db99fac..0a4a8d49 100644 --- a/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt +++ b/affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt @@ -96,6 +96,7 @@ class AffectedModuleDetectorPlugin : Plugin { val task = rootProject.tasks.register(taskType.commandByImpact).get() task.group = CUSTOM_TASK_GROUP_NAME task.description = taskType.taskDescription + disableConfigCache(task) rootProject.subprojects { project -> pluginIds.forEach { pluginId -> @@ -136,9 +137,7 @@ class AffectedModuleDetectorPlugin : Plugin { val task = rootProject.tasks.register(taskType.commandByImpact).get() task.group = groupName task.description = taskType.taskDescription - if (GradleVersion.current() >= GradleVersion.version("7.4")) { - task.notCompatibleWithConfigurationCache("AMD requires knowledge of what has changed in the file system so we can not cache those values (https://github.com/dropbox/AffectedModuleDetector/issues/150)") - } + disableConfigCache(task) rootProject.subprojects { project -> project.afterEvaluate { @@ -155,6 +154,12 @@ class AffectedModuleDetectorPlugin : Plugin { } } + private fun disableConfigCache(task: Task) { + if (GradleVersion.current() >= GradleVersion.version("7.4")) { + task.notCompatibleWithConfigurationCache("AMD requires knowledge of what has changed in the file system so we can not cache those values (https://github.com/dropbox/AffectedModuleDetector/issues/150)") + } + } + private fun withPlugin( pluginId: String, task: Task,