dexed project, remove nonsense chdir before compiling

This commit is contained in:
Basile Burg 2019-02-03 20:32:25 +01:00
parent 3266e97883
commit 5c9cf04d0e
1 changed files with 11 additions and 22 deletions

View File

@ -31,7 +31,6 @@ type
fCompilProc: TDexedProcess; fCompilProc: TDexedProcess;
fOnChange: TNotifyEvent; fOnChange: TNotifyEvent;
fModified: boolean; fModified: boolean;
fPreCompilePath: string;
fRootFolder: string; fRootFolder: string;
fBasePath: string; fBasePath: string;
fRunnerOldCwd: string; fRunnerOldCwd: string;
@ -749,7 +748,9 @@ var
prc: TProcess; prc: TProcess;
nme: string; nme: string;
i, j: integer; i, j: integer;
chd: string;
begin begin
chd := fFilename.extractFilePath;
for i := 0 to processInfo.simpleCommands.Count-1 do for i := 0 to processInfo.simpleCommands.Count-1 do
begin begin
nme := fSymStringExpander.expand(processInfo.simpleCommands[i]); nme := fSymStringExpander.expand(processInfo.simpleCommands[i]);
@ -762,6 +763,7 @@ begin
prc.Executable := lst[0]; prc.Executable := lst[0];
prc.Options:= [poUsePipes, poStderrToOutPut]; prc.Options:= [poUsePipes, poStderrToOutPut];
lst.Delete(0); lst.Delete(0);
prc.CurrentDirectory:= chd;
prc.Parameters.Assign(lst); prc.Parameters.Assign(lst);
prc.XTermProgram:=consoleProgram; prc.XTermProgram:=consoleProgram;
prc.Execute; prc.Execute;
@ -779,13 +781,13 @@ begin
if not com then if not com then
exit(false); exit(false);
end; end;
//
nme := fSymStringExpander.expand(processInfo.executable); nme := fSymStringExpander.expand(processInfo.executable);
if (not exeInSysPath(nme)) and nme.isNotEmpty then if (not exeInSysPath(nme)) and nme.isNotEmpty then
exit(false) exit(false)
else if nme.isEmpty then else if nme.isEmpty then
exit(true); exit(true);
//
prc := TProcess.Create(nil); prc := TProcess.Create(nil);
try try
processInfo.setProcess(prc); processInfo.setProcess(prc);
@ -796,8 +798,9 @@ begin
for i:= 0 to j do for i:= 0 to j do
prc.Parameters.Delete(0); prc.Parameters.Delete(0);
if prc.CurrentDirectory.isNotEmpty then if prc.CurrentDirectory.isNotEmpty then
prc.CurrentDirectory := fSymStringExpander.expand(prc.CurrentDirectory); prc.CurrentDirectory := fSymStringExpander.expand(prc.CurrentDirectory)
// else cwd is set to project dir in compile() else
prc.CurrentDirectory:= chd;
ensureNoPipeIfWait(prc); ensureNoPipeIfWait(prc);
prc.Execute; prc.Execute;
while prc.Running do while prc.Running do
@ -841,34 +844,22 @@ begin
fAsProjectItf, amcProj, amkErr); fAsProjectItf, amcProj, amkErr);
exit; exit;
end; end;
//
fMsgs.clearByData(fAsProjectItf); fMsgs.clearByData(fAsProjectItf);
subjProjCompiling(fProjectSubject, Self); subjProjCompiling(fProjectSubject, Self);
//
prjpath := fFileName.extractFilePath; prjpath := fFileName.extractFilePath;
fPreCompilePath := GetCurrentDirUTF8;
SetCurrentDirUTF8(prjpath);
//
if not runPrePostProcess(config.preBuildProcess) then if not runPrePostProcess(config.preBuildProcess) then
fMsgs.message('warning: pre-compilation process or commands not properly executed', fMsgs.message('warning: pre-compilation process or commands not properly executed',
fAsProjectItf, amcProj, amkWarn); fAsProjectItf, amcProj, amkWarn);
//
SetCurrentDirUTF8(prjpath);
//
if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then if (Sources.Count = 0) and (config.pathsOptions.extraSources.Count = 0) then
begin
SetCurrentDirUTF8(fPreCompilePath);
exit; exit;
end;
//
prjname := shortenPath(filename, 25); prjname := shortenPath(filename, 25);
fCompilProc := TDexedProcess.Create(nil); fCompilProc := TDexedProcess.Create(nil);
subjProjCompiling(fProjectSubject, fAsProjectItf); subjProjCompiling(fProjectSubject, fAsProjectItf);
fMsgs.message('compiling ' + prjname, fAsProjectItf, amcProj, amkInf); fMsgs.message('compiling ' + prjname, fAsProjectItf, amcProj, amkInf);
fMsgs.message(usingCompilerInfo(CEProjectCompiler), fAsProjectItf, amcProj, amkInf); fMsgs.message(usingCompilerInfo(CEProjectCompiler), fAsProjectItf, amcProj, amkInf);
// this doesn't work under linux, so the previous ChDir. fCompilProc.CurrentDirectory := prjpath;
if prjpath.dirExists then
fCompilProc.CurrentDirectory := prjpath;
fCompilProc.Executable := CEProjectCompilerFilename; fCompilProc.Executable := CEProjectCompilerFilename;
fCompilProc.Options := fCompilProc.Options + [poStderrToOutPut, poUsePipes]; fCompilProc.Options := fCompilProc.Options + [poStderrToOutPut, poUsePipes];
fCompilProc.ShowWindow := swoHIDE; fCompilProc.ShowWindow := swoHIDE;
@ -1002,8 +993,6 @@ begin
fMsgs.message( 'warning: post-compilation process or commands not properly executed', fMsgs.message( 'warning: post-compilation process or commands not properly executed',
fAsProjectItf, amcProj, amkWarn); fAsProjectItf, amcProj, amkWarn);
subjProjCompiled(fProjectSubject, fAsProjectItf, fCompiled); subjProjCompiled(fProjectSubject, fAsProjectItf, fCompiled);
//
SetCurrentDirUTF8(fPreCompilePath);
end; end;
function TNativeProject.targetUpToDate: boolean; function TNativeProject.targetUpToDate: boolean;