Skip to content

Commit

Permalink
Merge pull request woocommerce#10931 from woocommerce/skip_hilt_ksp_i…
Browse files Browse the repository at this point in the history
…n_tests

Skip `hilt` in unit tests. Do not execute `ksp` on unit test sources.
  • Loading branch information
malinajirka authored Feb 27, 2024
2 parents 5f2e15a + d9b755d commit 91e34e9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .buildkite/commands/run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "--- 🧪 Testing"
set +e
cp gradle.properties-example gradle.properties
./gradlew testJalapenoDebug lib:cardreader:testDebug lib:iap:testDebug
./gradlew testJalapenoDebugUnitTest lib:cardreader:testDebugUnitTest lib:iap:testDebugUnitTest
TESTS_EXIT_STATUS=$?
set -e

Expand Down
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
}
}
}
2 changes: 2 additions & 0 deletions gradle.properties-example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ org.gradle.jvmargs=-Xmx8g
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

ksp.allow.all.target.configuration=false

# Enables Gradle Build Cache - https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true

Expand Down

0 comments on commit 91e34e9

Please sign in to comment.