-
Notifications
You must be signed in to change notification settings - Fork 53
[WIP] #380 feat: implement dual checksum calculation #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[WIP] #380 feat: implement dual checksum calculation #381
Conversation
…se class refactoring - Add separate checksums for source and test inputs for enhanced build incrementality - Implement web-path compatible cache key format: `{source_checksum}-{test_checksum}` - Increment cache version to v1.2 (breaking change) - Create AbstractInputAnalyzer base class to eliminate code duplication - Refactor SrcInputAnalyzer and TestInputAnalyzer to extend base class - Reduce code duplication by ~300 lines (60% reduction) - Add comprehensive tests for dual checksum functionality Enhanced build logic: - Source-only changes: rebuild only if source checksum differs - Test-only changes: rebuild only if test checksum differs OR source changes - Both changed: full rebuild required - Neither changed: use cached results
|
||
// Add all input files to the hash | ||
for (Path inputFile : inputFiles) { | ||
checksum.update(inputFile.toString().getBytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBytes()
is using the platform's default charset, for portability between win/linux it is better to set encoding.
String sourceChecksum = combinedChecksum.substring(0, separatorIndex); | ||
String testChecksum = combinedChecksum.substring(separatorIndex + 1); | ||
|
||
return new String[] {sourceChecksum, testChecksum}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: split
if (sourceChanged && testChanged) { | ||
return RebuildType.FULL_REBUILD; | ||
} else if (sourceChanged) { | ||
return RebuildType.SOURCE_REBUILD; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the source changes, then the tests should be rebuilt too. For example, they might stop compiling.
final SortedMap<String, String> pluginDependenciesChecksum = getMutablePluginDependencies(); | ||
final String sourceChecksum = dualCalculator.calculateSourceChecksum(); | ||
final String testChecksum = dualCalculator.calculateTestChecksum(); | ||
final String combinedChecksum = dualCalculator.calculateDualChecksum(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will recalculate again sourceChecksum and testChecksum - could be calculated once
final HashChecksum checksum = config.getHashFactory().createChecksum(count); | ||
// Create digest items for the new dual checksum approach | ||
final List<DigestItem> items = new ArrayList<>(); | ||
final HashChecksum checksum = config.getHashFactory().createChecksum(3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is 3 in createChecksum(3)
?
DigestItem fileDigest = DigestUtils.file(checksum, baseDirPath, file); | ||
items.add(fileDigest); | ||
if (compareWithBaseline) { | ||
sourcesMatched &= checkItemMatchesBaseline(baselineHolder.get(), fileDigest); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was a diff report (compare 2 buildinfos from different sources to find mismatches). is it moved or deprecated?
Separate Source and Test Input Checksums for Enhanced Build Incrementality #380
Enhanced build logic:
Following this checklist to help us incorporate your
contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verify
to make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify
).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.