Skip to content

Commit 6897aa6

Browse files
committed
Fix code to better support when running project with configuration cache
1 parent 6c2b902 commit 6897aa6

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ abstract class AffectedModuleDetector {
216216
)
217217
}
218218

219-
private fun isProjectEnabled(project: Project): Boolean {
219+
internal fun isProjectEnabled(project: Project): Boolean {
220220
return project.hasProperty(ENABLE_ARG)
221221
}
222222

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
136136
task.description = taskType.taskDescription
137137

138138
rootProject.subprojects { project ->
139-
project.afterEvaluate {
139+
project.afterEvaluate { evaluatedProject ->
140140
pluginIds.forEach { pluginId ->
141141
if (pluginId == PLUGIN_JAVA_LIBRARY || pluginId == PLUGIN_KOTLIN) {
142142
if (taskType == InternalTaskType.ANDROID_JVM_TEST) {
143-
withPlugin(pluginId, task, InternalTaskType.JVM_TEST, project)
143+
withPlugin(pluginId, task, InternalTaskType.JVM_TEST, evaluatedProject)
144144
}
145145
} else {
146-
withPlugin(pluginId, task, taskType, project)
146+
withPlugin(pluginId, task, taskType, evaluatedProject)
147147
}
148148
}
149149
}
@@ -163,8 +163,11 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
163163
}
164164

165165
project.afterEvaluate {
166-
project.tasks.findByPath(path)?.onlyIf {
167-
AffectedModuleDetector.isProjectAffected(project)
166+
project.tasks.findByPath(path)?.onlyIf { task ->
167+
when {
168+
!AffectedModuleDetector.isProjectEnabled(task.project) -> true
169+
else -> AffectedModuleDetector.isProjectAffected(task.project)
170+
}
168171
}
169172
}
170173
}

0 commit comments

Comments
 (0)