mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 00:20:25 +02:00
Added MD5 file hashes to Beef
This commit is contained in:
parent
32c09bf94b
commit
61468d818f
33 changed files with 598 additions and 143 deletions
|
@ -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);
|
||||
|
|
|
@ -9,6 +9,7 @@ using IDE.ui;
|
|||
using System.IO;
|
||||
using System.Threading;
|
||||
using Beefy;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace IDE.Compiler
|
||||
{
|
||||
|
@ -94,6 +95,9 @@ namespace IDE.Compiler
|
|||
[StdCall, CLink]
|
||||
static extern void BfParser_SetCharIdData(void* bfParser, uint8* data, int32 length);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void BfParser_SetHashMD5(void* bfParser, ref MD5Hash md5Hash);
|
||||
|
||||
[StdCall, CLink]
|
||||
static extern void BfParser_SetNextRevision(void* bfParser, void* nextParser);
|
||||
|
||||
|
@ -352,5 +356,11 @@ namespace IDE.Compiler
|
|||
{
|
||||
BfParser_SetCompleteParse(mNativeBfParser);
|
||||
}
|
||||
|
||||
public void SetHashMD5(MD5Hash md5Hash)
|
||||
{
|
||||
var md5Hash;
|
||||
BfParser_SetHashMD5(mNativeBfParser, ref md5Hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace IDE.Compiler
|
|||
projectSource.GetFullImportPath(fullPath);
|
||||
if (Path.Equals(fullPath, entry.mFilePath))
|
||||
{
|
||||
app.mBfResolveCompiler.QueueProjectSource(projectSource);
|
||||
app.mBfResolveCompiler.QueueProjectSource(projectSource, false);
|
||||
needsResolveAll = true;
|
||||
DeferRefreshVisibleViews(entry.mExludeSourceViewPanel);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
|||
using Beefy.utils;
|
||||
using Beefy;
|
||||
using System.IO;
|
||||
using IDE.util;
|
||||
|
||||
namespace IDE.Compiler
|
||||
{
|
||||
|
@ -36,6 +37,7 @@ namespace IDE.Compiler
|
|||
public ProjectSource mProjectSource;
|
||||
public IdSpan mSourceCharIdData ~ _.Dispose();
|
||||
public String mSourceString ~ delete _;
|
||||
public SourceHash mSourceHash;
|
||||
}
|
||||
|
||||
protected class CompileCommand : Command
|
||||
|
@ -55,12 +57,12 @@ namespace IDE.Compiler
|
|||
mResolveAllWait = 2;
|
||||
}
|
||||
|
||||
public virtual void QueueProjectSource(ProjectSource projectSource)
|
||||
public virtual void QueueProjectSource(ProjectSource projectSource, bool wantsHash)
|
||||
{
|
||||
ProjectSourceCommand command = new ProjectSourceCommand();
|
||||
command.mProjectSource = projectSource;
|
||||
command.mSourceString = new String();
|
||||
IDEApp.sApp.FindProjectSourceContent(projectSource, out command.mSourceCharIdData, false, command.mSourceString);
|
||||
IDEApp.sApp.FindProjectSourceContent(projectSource, out command.mSourceCharIdData, false, command.mSourceString, wantsHash ? &command.mSourceHash : null);
|
||||
if (gApp.mBfBuildCompiler == this)
|
||||
{
|
||||
if (gApp.mDbgVersionedCompileDir != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue