Fix build caching: remove generateSecretKeys dependency from test#1028
Fix build caching: remove generateSecretKeys dependency from test#1028ribafish wants to merge 1 commit intoapache:trunkfrom
Conversation
The generateSecretKeys task writes new random keys to security.properties on every build, causing cascading cache misses for compileTestGroovy, checkstyleMain, checkstyleTest, and test. Use a git hook to remove the test dependency and provide fixed keys instead. Upstream fix: apache/ofbiz-framework#1028
The test task previously depended on generateSecretKeys, which writes new random values to security.properties on every build. Since this file is part of the main resource source set, it causes cascading cache misses for compileTestGroovy, checkstyleMain, checkstyleTest, and test. Instead, provide a test-specific security.properties with fixed keys in framework/security/src/test/resources/. This shadows the main config on the test classpath, so unit tests that need JWT keys (e.g. ModelFormTest) still work. The generateSecretKeys task remains available for manual use and for the loadAll task.
d92eb60 to
4054eb6
Compare
|
Thanks for the quick fix in #1029! It does resolve the issue for local build cache reuse (two consecutive builds on the same machine) — the first build generates keys, the second sees them and skips. However, it doesn't fully address cross-machine build cache reuse. On a fresh checkout the keys are empty, so This PR complements #1029 by removing |
Summary
The
testtask depends ongenerateSecretKeys, which writes new random values toframework/security/config/security.propertieson every build. Since this file is part of the main resource source set (config/dirs are included viagetDirectoryInActiveComponentsIfExists('config')), changing it causes cascading Gradle build cache misses for::compileTestGroovy— classpath includes main resources:checkstyleMain— classpath includessourceSets.main.output:checkstyleTest— same reason:test— classpath + test classes differThis PR:
dependsOn 'generateSecretKeys'from thetesttask — the mainsecurity.propertiesis no longer mutated duringbuildsecurity.propertiesinframework/security/src/test/resources/with fixed keys — this shadows the main config on the test classpath so unit tests that require JWT keys (e.g.ModelFormTest) continue to workThe
generateSecretKeystask is unchanged and remains available for manual use (./gradlew generateSecretKeys) and as a dependency ofloadAll.