mirror of https://gitlab.com/basile.b/dexed.git
ce & dub projects, get messages service in ctor
This commit is contained in:
parent
0152510c4e
commit
f779e16712
|
@ -76,6 +76,7 @@ type
|
||||||
fOutputFileName: string;
|
fOutputFileName: string;
|
||||||
fSaveAsUtf8: boolean;
|
fSaveAsUtf8: boolean;
|
||||||
fCompiled: boolean;
|
fCompiled: boolean;
|
||||||
|
fMsgs: ICEMessagesDisplay;
|
||||||
//
|
//
|
||||||
procedure doModified;
|
procedure doModified;
|
||||||
procedure updateFields;
|
procedure updateFields;
|
||||||
|
@ -268,6 +269,7 @@ begin
|
||||||
fSaveAsUtf8 := true;
|
fSaveAsUtf8 := true;
|
||||||
fJSON := TJSONObject.Create();
|
fJSON := TJSONObject.Create();
|
||||||
fProjectSubject := TCEProjectSubject.Create;
|
fProjectSubject := TCEProjectSubject.Create;
|
||||||
|
fMsgs:= getMessageDisplay;
|
||||||
fBuildTypes := TStringList.Create;
|
fBuildTypes := TStringList.Create;
|
||||||
fConfigs := TStringList.Create;
|
fConfigs := TStringList.Create;
|
||||||
fSrcs := TStringList.Create;
|
fSrcs := TStringList.Create;
|
||||||
|
@ -546,14 +548,12 @@ procedure TCEDubProject.dubProcOutput(proc: TObject);
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
begin
|
begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
msgs := getMessageDisplay;
|
|
||||||
try
|
try
|
||||||
fDubProc.getFullLines(lst);
|
fDubProc.getFullLines(lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
msgs.message(str, self as ICECommonProject, amcProj, amkAuto);
|
fMsgs.message(str, self as ICECommonProject, amcProj, amkAuto);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -561,18 +561,16 @@ end;
|
||||||
|
|
||||||
procedure TCEDubProject.dubProcTerminated(proc: TObject);
|
procedure TCEDubProject.dubProcTerminated(proc: TObject);
|
||||||
var
|
var
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
prjname: string;
|
prjname: string;
|
||||||
begin
|
begin
|
||||||
dubProcOutput(proc);
|
dubProcOutput(proc);
|
||||||
msgs := getMessageDisplay;
|
|
||||||
prjname := shortenPath(filename);
|
prjname := shortenPath(filename);
|
||||||
fCompiled := fDubProc.ExitStatus = 0;
|
fCompiled := fDubProc.ExitStatus = 0;
|
||||||
if fCompiled then
|
if fCompiled then
|
||||||
msgs.message(prjname + ' has been successfully compiled',
|
fMsgs.message(prjname + ' has been successfully compiled',
|
||||||
self as ICECommonProject, amcProj, amkInf)
|
self as ICECommonProject, amcProj, amkInf)
|
||||||
else
|
else
|
||||||
msgs.message(prjname + ' has not been compiled',
|
fMsgs.message(prjname + ' has not been compiled',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
||||||
SetCurrentDirUTF8(fPreCompilePath);
|
SetCurrentDirUTF8(fPreCompilePath);
|
||||||
|
@ -582,12 +580,10 @@ procedure TCEDubProject.compileOrRun(run: boolean; const runArgs: string = '');
|
||||||
var
|
var
|
||||||
olddir: string;
|
olddir: string;
|
||||||
prjname: string;
|
prjname: string;
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
begin
|
begin
|
||||||
msgs := getMessageDisplay;
|
|
||||||
if fDubProc.isNotNil and fDubProc.Active then
|
if fDubProc.isNotNil and fDubProc.Active then
|
||||||
begin
|
begin
|
||||||
msgs.message('the project is already being compiled',
|
fMsgs.message('the project is already being compiled',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -598,7 +594,7 @@ begin
|
||||||
dlgOkInfo('The DUB project must be saved before being compiled or run !');
|
dlgOkInfo('The DUB project must be saved before being compiled or run !');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
msgs.clearByData(Self as ICECommonProject);
|
fMsgs.clearByData(Self as ICECommonProject);
|
||||||
prjname := shortenPath(fFilename);
|
prjname := shortenPath(fFilename);
|
||||||
fDubProc:= TCEProcess.Create(nil);
|
fDubProc:= TCEProcess.Create(nil);
|
||||||
olddir := GetCurrentDir;
|
olddir := GetCurrentDir;
|
||||||
|
@ -606,7 +602,7 @@ begin
|
||||||
if not run then
|
if not run then
|
||||||
begin
|
begin
|
||||||
subjProjCompiling(fProjectSubject, self as ICECommonProject);
|
subjProjCompiling(fProjectSubject, self as ICECommonProject);
|
||||||
msgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
fMsgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
||||||
if modified then saveToFile(fFilename);
|
if modified then saveToFile(fFilename);
|
||||||
end;
|
end;
|
||||||
chDir(fFilename.extractFilePath);
|
chDir(fFilename.extractFilePath);
|
||||||
|
|
|
@ -47,6 +47,7 @@ type
|
||||||
fBaseConfig: TCompilerConfiguration;
|
fBaseConfig: TCompilerConfiguration;
|
||||||
fCompiled: boolean;
|
fCompiled: boolean;
|
||||||
fSymStringExpander: ICESymStringExpander;
|
fSymStringExpander: ICESymStringExpander;
|
||||||
|
fMsgs: ICEMessagesDisplay;
|
||||||
procedure updateOutFilename;
|
procedure updateOutFilename;
|
||||||
procedure doChanged(modified: boolean = true);
|
procedure doChanged(modified: boolean = true);
|
||||||
procedure getBaseConfig;
|
procedure getBaseConfig;
|
||||||
|
@ -144,6 +145,7 @@ constructor TCENativeProject.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
fSymStringExpander := getSymStringExpander;
|
fSymStringExpander := getSymStringExpander;
|
||||||
|
fMsgs:= getMessageDisplay;
|
||||||
//
|
//
|
||||||
fRunnerOldCwd := GetCurrentDirUTF8;
|
fRunnerOldCwd := GetCurrentDirUTF8;
|
||||||
fProjectSubject := TCEProjectSubject.create;
|
fProjectSubject := TCEProjectSubject.create;
|
||||||
|
@ -672,7 +674,7 @@ begin
|
||||||
sleep(1);
|
sleep(1);
|
||||||
com := prc.ExitStatus = 0;
|
com := prc.ExitStatus = 0;
|
||||||
for j := 0 to lst.Count -1 do
|
for j := 0 to lst.Count -1 do
|
||||||
getMessageDisplay.message(lst[j], self as ICECommonProject, amcProj, amkAuto);
|
fMsgs.message(lst[j], self as ICECommonProject, amcProj, amkAuto);
|
||||||
finally
|
finally
|
||||||
prc.Free;
|
prc.Free;
|
||||||
lst.Free;
|
lst.Free;
|
||||||
|
@ -720,12 +722,10 @@ var
|
||||||
config: TCompilerConfiguration;
|
config: TCompilerConfiguration;
|
||||||
prjpath: string;
|
prjpath: string;
|
||||||
prjname: string;
|
prjname: string;
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
begin
|
begin
|
||||||
msgs := getMessageDisplay;
|
|
||||||
if fCompilProc.isNotNil and fCompilProc.Active then
|
if fCompilProc.isNotNil and fCompilProc.Active then
|
||||||
begin
|
begin
|
||||||
msgs.message('the project is already being compiled',
|
fMsgs.message('the project is already being compiled',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -734,12 +734,12 @@ begin
|
||||||
config := currentConfiguration;
|
config := currentConfiguration;
|
||||||
if config.isNil then
|
if config.isNil then
|
||||||
begin
|
begin
|
||||||
msgs.message('unexpected project error: no active configuration',
|
fMsgs.message('unexpected project error: no active configuration',
|
||||||
self as ICECommonProject, amcProj, amkErr);
|
self as ICECommonProject, amcProj, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
msgs.clearByData(self as ICECommonProject);
|
fMsgs.clearByData(self as ICECommonProject);
|
||||||
subjProjCompiling(fProjectSubject, Self);
|
subjProjCompiling(fProjectSubject, Self);
|
||||||
//
|
//
|
||||||
prjpath := fFileName.extractFilePath;
|
prjpath := fFileName.extractFilePath;
|
||||||
|
@ -747,7 +747,7 @@ begin
|
||||||
SetCurrentDirUTF8(prjpath);
|
SetCurrentDirUTF8(prjpath);
|
||||||
//
|
//
|
||||||
if not runPrePostProcess(config.preBuildProcess) then
|
if not runPrePostProcess(config.preBuildProcess) then
|
||||||
msgs.message('warning: pre-compilation process or commands not properly executed',
|
fMsgs.message('warning: pre-compilation process or commands not properly executed',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
//
|
//
|
||||||
SetCurrentDirUTF8(prjpath);
|
SetCurrentDirUTF8(prjpath);
|
||||||
|
@ -761,7 +761,7 @@ begin
|
||||||
prjname := shortenPath(filename, 25);
|
prjname := shortenPath(filename, 25);
|
||||||
fCompilProc := TCEProcess.Create(nil);
|
fCompilProc := TCEProcess.Create(nil);
|
||||||
subjProjCompiling(fProjectSubject, self as ICECommonProject);
|
subjProjCompiling(fProjectSubject, self as ICECommonProject);
|
||||||
msgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
fMsgs.message('compiling ' + prjname, self as ICECommonProject, amcProj, amkInf);
|
||||||
// this doesn't work under linux, so the previous ChDir.
|
// this doesn't work under linux, so the previous ChDir.
|
||||||
if prjpath.dirExists then
|
if prjpath.dirExists then
|
||||||
fCompilProc.CurrentDirectory := prjpath;
|
fCompilProc.CurrentDirectory := prjpath;
|
||||||
|
@ -802,7 +802,7 @@ begin
|
||||||
//
|
//
|
||||||
if not outputFilename.fileExists then
|
if not outputFilename.fileExists then
|
||||||
begin
|
begin
|
||||||
getMessageDisplay.message('output executable missing: ' + shortenPath(outputFilename, 25),
|
fMsgs.message('output executable missing: ' + shortenPath(outputFilename, 25),
|
||||||
self as ICECommonProject, amcProj, amkErr);
|
self as ICECommonProject, amcProj, amkErr);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -827,18 +827,16 @@ procedure TCENativeProject.runProcOutput(sender: TObject);
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
proc: TProcess;
|
proc: TProcess;
|
||||||
begin
|
begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
msgs := getMessageDisplay;
|
|
||||||
try
|
try
|
||||||
if (sender is TCEProcess) then
|
if (sender is TCEProcess) then
|
||||||
(sender as TCEProcess).getFullLines(lst)
|
(sender as TCEProcess).getFullLines(lst)
|
||||||
else
|
else
|
||||||
processOutputToStrings(TProcess(sender), lst);
|
processOutputToStrings(TProcess(sender), lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
msgs.message(str, self as ICECommonProject, amcProj, amkBub);
|
fMsgs.message(str, self as ICECommonProject, amcProj, amkBub);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -850,7 +848,7 @@ begin
|
||||||
SetCurrentDirUTF8(fRunnerOldCwd);
|
SetCurrentDirUTF8(fRunnerOldCwd);
|
||||||
//
|
//
|
||||||
if (proc.ExitStatus <> 0) then
|
if (proc.ExitStatus <> 0) then
|
||||||
msgs.message(format('error: the process (%s) has returned the signal %d',
|
fMsgs.message(format('error: the process (%s) has returned the signal %d',
|
||||||
[proc.Executable, proc.ExitStatus]), self as ICECommonProject, amcProj, amkErr);
|
[proc.Executable, proc.ExitStatus]), self as ICECommonProject, amcProj, amkErr);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -859,14 +857,12 @@ procedure TCENativeProject.compProcOutput(proc: TObject);
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
str: string;
|
str: string;
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
begin
|
begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
msgs := getMessageDisplay;
|
|
||||||
fCompilProc.getFullLines(lst);
|
fCompilProc.getFullLines(lst);
|
||||||
for str in lst do
|
for str in lst do
|
||||||
msgs.message(str, self as ICECommonProject, amcProj, amkAuto);
|
fMsgs.message(str, self as ICECommonProject, amcProj, amkAuto);
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -874,23 +870,21 @@ end;
|
||||||
|
|
||||||
procedure TCENativeProject.compProcTerminated(proc: TObject);
|
procedure TCENativeProject.compProcTerminated(proc: TObject);
|
||||||
var
|
var
|
||||||
msgs: ICEMessagesDisplay;
|
|
||||||
prjname: string;
|
prjname: string;
|
||||||
begin
|
begin
|
||||||
compProcOutput(proc);
|
compProcOutput(proc);
|
||||||
msgs := getMessageDisplay;
|
|
||||||
prjname := shortenPath(filename);
|
prjname := shortenPath(filename);
|
||||||
fCompiled := fCompilProc.ExitStatus = 0;
|
fCompiled := fCompilProc.ExitStatus = 0;
|
||||||
updateOutFilename;
|
updateOutFilename;
|
||||||
if fCompiled then
|
if fCompiled then
|
||||||
msgs.message(prjname + ' has been successfully compiled',
|
fMsgs.message(prjname + ' has been successfully compiled',
|
||||||
self as ICECommonProject, amcProj, amkInf)
|
self as ICECommonProject, amcProj, amkInf)
|
||||||
else
|
else
|
||||||
msgs.message(prjname + ' has not been compiled',
|
fMsgs.message(prjname + ' has not been compiled',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
//
|
//
|
||||||
if not runPrePostProcess(getCurrConf.postBuildProcess) then
|
if not runPrePostProcess(getCurrConf.postBuildProcess) then
|
||||||
msgs.message( 'warning: post-compilation process or commands not properly executed',
|
fMsgs.message( 'warning: post-compilation process or commands not properly executed',
|
||||||
self as ICECommonProject, amcProj, amkWarn);
|
self as ICECommonProject, amcProj, amkWarn);
|
||||||
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
subjProjCompiled(fProjectSubject, self as ICECommonProject, fCompiled);
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue