Skip to content

Commit 974485f

Browse files
Merge pull request #152 from dropbox/jfein/disable-config-cache
Upgrade Gradle Plugin so we can have knowledge of how to disable config cache
2 parents 4edeb41 + 9c5040e commit 974485f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.gradle.api.Project
99
import org.gradle.api.Task
1010
import org.gradle.api.tasks.testing.Test
1111
import org.gradle.internal.impldep.org.jetbrains.annotations.VisibleForTesting
12+
import org.gradle.util.GradleVersion
1213

1314
/**
1415
* This plugin creates and registers all affected test tasks.
@@ -95,6 +96,7 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
9596
val task = rootProject.tasks.register(taskType.commandByImpact).get()
9697
task.group = CUSTOM_TASK_GROUP_NAME
9798
task.description = taskType.taskDescription
99+
disableConfigCache(task)
98100

99101
rootProject.subprojects { project ->
100102
pluginIds.forEach { pluginId ->
@@ -125,6 +127,7 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
125127
)
126128
}
127129

130+
@Suppress("UnstableApiUsage")
128131
@VisibleForTesting
129132
internal fun registerInternalTask(
130133
rootProject: Project,
@@ -134,6 +137,7 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
134137
val task = rootProject.tasks.register(taskType.commandByImpact).get()
135138
task.group = groupName
136139
task.description = taskType.taskDescription
140+
disableConfigCache(task)
137141

138142
rootProject.subprojects { project ->
139143
project.afterEvaluate { evaluatedProject ->
@@ -150,6 +154,12 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
150154
}
151155
}
152156

157+
private fun disableConfigCache(task: Task) {
158+
if (GradleVersion.current() >= GradleVersion.version("7.4")) {
159+
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)")
160+
}
161+
}
162+
153163
private fun withPlugin(
154164
pluginId: String,
155165
task: Task,

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip

sample/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip

0 commit comments

Comments
 (0)