Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kozaxinan committed Feb 10, 2024
1 parent 3871eec commit 61d8dde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class AffectedModuleDetectorIntegrationTest {

// THEN
assertThat(result.output).contains(":sample-app:assembleDebugAndroidTest SKIPPED")
assertThat(result.output).contains(":sample-core:mergeDexDebugAndroidTest SKIPPED")
assertThat(result.output).contains(":sample-core:packageDebugAndroidTest SKIPPED")
assertThat(result.output).contains(":sample-core:assembleDebugAndroidTest SKIPPED")
assertThat(result.output).contains(":sample-core:assembleAndroidTest SKIPPED")
assertThat(result.output).contains(":assembleAffectedAndroidTests SKIPPED")
}
Expand Down Expand Up @@ -190,6 +193,9 @@ class AffectedModuleDetectorIntegrationTest {

// THEN
assertThat(result.output).contains(":sample-app:assembleDebugAndroidTest SKIPPED")
assertThat(result.output).doesNotContain(":sample-core:mergeDexDebugAndroidTest")
assertThat(result.output).doesNotContain(":sample-core:packageDebugAndroidTest")
assertThat(result.output).doesNotContain(":sample-core:assembleDebugAndroidTest")
assertThat(result.output).doesNotContain(":sample-core:assembleAndroidTest")
assertThat(result.output).contains(":assembleAffectedAndroidTests SKIPPED")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,15 @@ class AffectedTasksPlugin : Plugin<Project> {
private fun registerAffectedTestTask(
taskName: String, testTask: String, testTaskBackup: String?,
rootProject: Project
): Task {
val task = rootProject.tasks.register(taskName) { task ->
) {
rootProject.tasks.register(taskName) { task ->
val paths = getAffectedPaths(testTask, testTaskBackup, rootProject)
paths.forEach { path ->
task.dependsOn(path)
}
task.enabled = paths.isNotEmpty()
task.onlyIf { paths.isNotEmpty() }
}
return task.get()
}

private fun getAffectedPaths(
Expand Down

0 comments on commit 61d8dde

Please sign in to comment.