Description
The generator's Controller loops over a list of UnitDescriptors, each of which may have set the option to run only on a source change. Currently, the cached checksum file is overwritten by each successive call to processGenerationUnit(ControllerState, UnitConfiguration) resulting in only the last UnitDescriptor to be skipped on a subsequent run. The following patch to Checksums addresses this issue:
Index: torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java =================================================================== --- torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java (revision 1689921) +++ torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java (working copy) @@ -128,6 +128,29 @@ Set<String> keys = new HashSet<String>(); keys.addAll(checksums.keySet()); keys.addAll(modificationDates.keySet()); + + Checksums existing = new Checksums(); + existing.readFromFile(toWriteTo); + for (String key : existing.getChecksums().keySet()) + { + if (keys.add(key)) + { + checksums.put(key, existing.getChecksum(key)); + if (existing.getModificationDate(key) != null) + { + modificationDates.put(key, existing.getModificationDate(key)); + } + } + } + + for (String key : existing.getModificationDates().keySet()) + { + if (keys.add(key)) + { + modificationDates.put(key, existing.getModificationDate(key)); + } + } + StringBuilder content = new StringBuilder(); for (String key : keys) {