Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
customTasks: Set<AffectedModuleTaskType>
) {
customTasks.forEach { taskType ->
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 ->
withPlugin(pluginId, task, taskType, project)
rootProject.tasks.register(taskType.commandByImpact) { task ->
task.group = CUSTOM_TASK_GROUP_NAME
task.description = taskType.taskDescription
disableConfigCache(task)

rootProject.subprojects { project ->
pluginIds.forEach { pluginId ->
withPlugin(pluginId, task, taskType, project)
}
}
}
}
Expand Down Expand Up @@ -134,20 +135,19 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
taskType: AffectedModuleTaskType,
groupName: String
) {
val task = rootProject.tasks.register(taskType.commandByImpact).get()
task.group = groupName
task.description = taskType.taskDescription
disableConfigCache(task)
rootProject.tasks.register(taskType.commandByImpact) { task ->
task.group = groupName
task.description = taskType.taskDescription
disableConfigCache(task)

rootProject.subprojects { project ->
project.afterEvaluate { evaluatedProject ->
rootProject.subprojects { project ->
pluginIds.forEach { pluginId ->
if (pluginId == PLUGIN_JAVA_LIBRARY || pluginId == PLUGIN_KOTLIN) {
if (taskType == InternalTaskType.ANDROID_JVM_TEST) {
withPlugin(pluginId, task, InternalTaskType.JVM_TEST, evaluatedProject)
withPlugin(pluginId, task, InternalTaskType.JVM_TEST, project)
}
} else {
withPlugin(pluginId, task, taskType, evaluatedProject)
withPlugin(pluginId, task, taskType, project)
}
}
}
Expand All @@ -172,12 +172,10 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
task.dependsOn(path)
}

project.afterEvaluate {
project.tasks.findByPath(path)?.onlyIf { task ->
when {
!AffectedModuleDetector.isProjectEnabled(task.project) -> true
else -> AffectedModuleDetector.isProjectAffected(task.project)
}
project.tasks.findByPath(path)?.onlyIf { task ->
when {
!AffectedModuleDetector.isProjectEnabled(task.project) -> true
else -> AffectedModuleDetector.isProjectAffected(task.project)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class AffectedModuleDetectorPluginTest {
// GIVEN
val task = fakeTask
val plugin = AffectedModuleDetectorPlugin()
rootProject.pluginManager.apply(AffectedModuleDetectorPlugin::class.java)

// WHEN
plugin.registerInternalTask(
Expand Down