[Feature Request] Don't overwrite output files when output file is not changed.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 890
- Avg merge
- 2h 11m
- Merged PRs (30d)
- 10
Description
**Is your feature request related to a problem? Please describe.**
When executing `docfx metadata` and `docfx build` commands.
All output files are overwritten every times even if no output file content is not changed.
It's desirable behaviors to overwrite files only when content are changed.
(These behaviors are caused by dropping `Incremental Build` features by #8379)
**Describe the solution you'd like**
Check output file's hash with XxHash64 (or XxHash128) when overwrite files.
And skip overwrite operations when hash is not changed.
There behaviors are affected by PostProcesssors that modify output files.
It may require intermediate directory to build documents. and then copy changed files to `dest` directory.
**Background**
Following problems occurred when overwrite files every times when no content changed.
- File's `LastWriteTime` property is changed every time when running `dotnet metadata` (Related to #8820)
- When running `dotnet watch` command that watch `_site` directory.
Callback is executed every times when running `docfx build` executed.
**Additional context**
As far as I've tested on my local environment.
Overhead of `Calculate hash of file with XxHash64` is relatively small.
And build time is faster when content are not changes. (I've tested by modifying `HtmlPostProcessor.cs`)
It may be faster when including `output file hash` in `manifest,json`.
(to skip to calculation of `output file hash` every time.)
Contributor guide
Assessment
This issue has not been assessed yet.