mirror of https://gitlab.com/basile.b/dexed.git
ceproject, pre/post bld proc, skip simple commands that are empty
This commit is contained in:
parent
83b20d593d
commit
5f0bba91d4
|
@ -669,62 +669,64 @@ function TCENativeProject.runPrePostProcess(processInfo: TCompileProcOptions): B
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
com: boolean;
|
com: boolean;
|
||||||
proc: TProcess;
|
prc: TProcess;
|
||||||
pname: string;
|
nme: string;
|
||||||
i, j: integer;
|
i, j: integer;
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
for i := 0 to processInfo.simpleCommands.Count-1 do
|
for i := 0 to processInfo.simpleCommands.Count-1 do
|
||||||
begin
|
begin
|
||||||
pname := fSymStringExpander.expand(processInfo.simpleCommands[i]);
|
nme := fSymStringExpander.expand(processInfo.simpleCommands[i]);
|
||||||
proc := TProcess.Create(nil);
|
if nme.isBlank then
|
||||||
|
continue;
|
||||||
|
prc := TProcess.Create(nil);
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
CommandToList(pname, lst);
|
CommandToList(nme, lst);
|
||||||
proc.Executable := lst[0];
|
prc.Executable := lst[0];
|
||||||
proc.Options:= [poUsePipes, poStderrToOutPut];
|
prc.Options:= [poUsePipes, poStderrToOutPut];
|
||||||
lst.Delete(0);
|
lst.Delete(0);
|
||||||
proc.Parameters.Assign(lst);
|
prc.Parameters.Assign(lst);
|
||||||
proc.Execute;
|
prc.Execute;
|
||||||
com := proc.ExitCode = 0;
|
com := prc.ExitCode = 0;
|
||||||
lst.Clear;
|
lst.Clear;
|
||||||
ce_common.processOutputToStrings(proc, lst);
|
processOutputToStrings(prc, lst);
|
||||||
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);
|
getMessageDisplay.message(lst[j], self as ICECommonProject, amcProj, amkAuto);
|
||||||
finally
|
finally
|
||||||
proc.Free;
|
prc.Free;
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
if not com then
|
if not com then
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
pname := fSymStringExpander.expand(processInfo.executable);
|
nme := fSymStringExpander.expand(processInfo.executable);
|
||||||
if (not exeInSysPath(pname)) and pname.isNotEmpty then
|
if (not exeInSysPath(nme)) and nme.isNotEmpty then
|
||||||
exit(false)
|
exit(false)
|
||||||
else if pname.isEmpty then
|
else if nme.isEmpty then
|
||||||
exit(true);
|
exit(true);
|
||||||
//
|
//
|
||||||
proc := TProcess.Create(nil);
|
prc := TProcess.Create(nil);
|
||||||
try
|
try
|
||||||
processInfo.setProcess(proc);
|
processInfo.setProcess(prc);
|
||||||
proc.Executable := exeFullName(pname);
|
prc.Executable := exeFullName(nme);
|
||||||
j := proc.Parameters.Count-1;
|
j := prc.Parameters.Count-1;
|
||||||
for i:= 0 to j do
|
for i:= 0 to j do
|
||||||
proc.Parameters.AddText(fSymStringExpander.expand(proc.Parameters[i]));
|
prc.Parameters.AddText(fSymStringExpander.expand(prc.Parameters[i]));
|
||||||
for i:= 0 to j do
|
for i:= 0 to j do
|
||||||
proc.Parameters.Delete(0);
|
prc.Parameters.Delete(0);
|
||||||
if proc.CurrentDirectory.isNotEmpty then
|
if prc.CurrentDirectory.isNotEmpty then
|
||||||
proc.CurrentDirectory := fSymStringExpander.expand(proc.CurrentDirectory);
|
prc.CurrentDirectory := fSymStringExpander.expand(prc.CurrentDirectory);
|
||||||
// else cwd is set to project dir in compile()
|
// else cwd is set to project dir in compile()
|
||||||
ensureNoPipeIfWait(proc);
|
ensureNoPipeIfWait(prc);
|
||||||
proc.Execute;
|
prc.Execute;
|
||||||
while proc.Running do
|
while prc.Running do
|
||||||
if poUsePipes in proc.Options then
|
if poUsePipes in prc.Options then
|
||||||
runProcOutput(proc);
|
runProcOutput(prc);
|
||||||
finally
|
finally
|
||||||
result := proc.ExitStatus = 0;
|
result := prc.ExitStatus = 0;
|
||||||
proc.Free;
|
prc.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue