Skip to content
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

Md5 hash diffing to skip generating unchanged files #316

Merged
merged 5 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified run.n
Binary file not shown.
18 changes: 18 additions & 0 deletions src/dox/Dox.hx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,25 @@ class Dox {
function parseFile(path) {
var name = new Path(path).file;
Sys.println('Parsing $path');

var hashPaths = cfg.outputPath + "/hashes/";

if (!FileSystem.exists(hashPaths))
FileSystem.createDirectory(hashPaths);

var data = sys.io.File.getContent(path);
var md5Hash = haxe.crypto.Md5.encode(data);

if (sys.FileSystem.exists(hashPaths + name + ".md5")) {
var previousHash = sys.io.File.getContent(hashPaths + name + ".md5");
if (md5Hash == previousHash) {
Sys.println('Skipping $path, no file changes detected');
return;
}
}

sys.io.File.saveContent(hashPaths + name + ".md5", md5Hash);

var xml = try Xml.parse(data).firstElement() catch (err:Dynamic) {
trace('Error while parsing $path');
throw err;
Expand Down
Loading