1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Added MD5 file hashes to Beef

This commit is contained in:
Brian Fiete 2020-03-23 12:07:05 -07:00
parent 32c09bf94b
commit 61468d818f
33 changed files with 598 additions and 143 deletions

View file

@ -9,6 +9,7 @@ using Beefy;
using Beefy.utils;
using IDE.Util;
using IDE.ui;
using IDE.util;
namespace IDE.Compiler
{
@ -373,13 +374,19 @@ namespace IDE.Compiler
bfProject = mBfSystem.GetBfProject(projectSource.mProject);
}
bool wantsHash = !mIsResolveOnly;
bool canMoveSourceString = true;
IdSpan char8IdData = projectSourceCommand.mSourceCharIdData;
String data = projectSourceCommand.mSourceString;
SourceHash hash = .None;
if (wantsHash)
hash = projectSourceCommand.mSourceHash;
if (char8IdData.IsEmpty)
{
data = scope:ProjectSourceCommandBlock String();
if (gApp.LoadTextFile(sourceFilePath, data) case .Err)
if (gApp.LoadTextFile(sourceFilePath, data, true, scope [&] () => { if (wantsHash) hash = SourceHash.Create(.MD5, data); } ) case .Err)
data = null;
if (data != null)
{
@ -390,6 +397,8 @@ namespace IDE.Compiler
using (gApp.mMonitor.Enter())
{
editData.SetSavedData(data, char8IdData);
if (hash case .MD5(let md5Hash))
editData.mMD5Hash = md5Hash;
}
canMoveSourceString = false;
}
@ -419,6 +428,9 @@ namespace IDE.Compiler
bfParser.SetSource("", sourceFilePath);
bfParser.SetCharIdData(ref char8IdData);
if (hash case .MD5(let md5Hash))
bfParser.SetHashMD5(md5Hash);
//passInstance.SetProject(bfProject);
worked &= bfParser.Parse(passInstance, false);
worked &= bfParser.Reduce(passInstance);