Skip to content

Commit

Permalink
build: disable hilt tasks when executing unit tests
Browse files Browse the repository at this point in the history
Hilt/Dagger are not used in unit tests, so we don't need to execute those tasks. This improves unit tests execution performance.
  • Loading branch information
wzieba committed Feb 26, 2024
1 parent 799e0e6 commit 7fc008f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,4 @@ if (project.hasProperty("debugStoreFile")) {
}
}

apply from: '../config/gradle/build_optimization.gradle'
9 changes: 9 additions & 0 deletions config/gradle/build_optimization.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for (taskName in gradle.startParameter.taskNames) {
if (taskName.contains("UnitTest")) {
tasks.matching { it.name.startsWith("hilt") }
.configureEach {
logger.warn("Disabling task ${it.name} for unit tests")
enabled = false
}
}
}

0 comments on commit 7fc008f

Please sign in to comment.