mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 13:19:12 +02:00
* Set exitcode=1 when a package failed to compile and threads are used
* Show the error-message as last message when threads are used git-svn-id: trunk@20316 -
This commit is contained in:
parent
2735e656b0
commit
668dbde745
@ -1064,6 +1064,7 @@ Type
|
|||||||
FBuildEngine: TBuildEngine;
|
FBuildEngine: TBuildEngine;
|
||||||
FCompilationOK: boolean;
|
FCompilationOK: boolean;
|
||||||
FDone: boolean;
|
FDone: boolean;
|
||||||
|
FErrorMessage: string;
|
||||||
FNotifyMainThreadEvent: PRTLEvent;
|
FNotifyMainThreadEvent: PRTLEvent;
|
||||||
FNotifyStartTask: PRTLEvent;
|
FNotifyStartTask: PRTLEvent;
|
||||||
FPackage: TPackage;
|
FPackage: TPackage;
|
||||||
@ -1073,6 +1074,7 @@ Type
|
|||||||
property APackage: TPackage read FPackage write FPackage;
|
property APackage: TPackage read FPackage write FPackage;
|
||||||
property CompilationOK: boolean read FCompilationOK;
|
property CompilationOK: boolean read FCompilationOK;
|
||||||
property NotifyStartTask: PRTLEvent read FNotifyStartTask;
|
property NotifyStartTask: PRTLEvent read FNotifyStartTask;
|
||||||
|
property ErrorMessage: string read FErrorMessage;
|
||||||
public
|
public
|
||||||
constructor Create(ABuildEngine: TBuildEngine; NotifyMainThreadEvent: PRTLEvent); virtual;
|
constructor Create(ABuildEngine: TBuildEngine; NotifyMainThreadEvent: PRTLEvent); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -2090,7 +2092,7 @@ begin
|
|||||||
FCompilationOK:=true;
|
FCompilationOK:=true;
|
||||||
except
|
except
|
||||||
on E: Exception do
|
on E: Exception do
|
||||||
writeln(E.Message);
|
FErrorMessage := E.Message;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -5763,6 +5765,8 @@ Var
|
|||||||
{$ifndef NO_THREADING}
|
{$ifndef NO_THREADING}
|
||||||
Thr : Integer;
|
Thr : Integer;
|
||||||
Finished : boolean;
|
Finished : boolean;
|
||||||
|
ErrorState: boolean;
|
||||||
|
ErrorMessage: string;
|
||||||
NotifyThreadWaiting : PRTLEvent;
|
NotifyThreadWaiting : PRTLEvent;
|
||||||
Threads : array of TCompileWorkerThread;
|
Threads : array of TCompileWorkerThread;
|
||||||
{$endif NO_THREADING}
|
{$endif NO_THREADING}
|
||||||
@ -5783,7 +5787,11 @@ Var
|
|||||||
if AThread.CompilationOK then
|
if AThread.CompilationOK then
|
||||||
AThread.APackage.FTargetState:=tsCompiled
|
AThread.APackage.FTargetState:=tsCompiled
|
||||||
else // A problem occured, stop the compilation
|
else // A problem occured, stop the compilation
|
||||||
|
begin
|
||||||
|
ErrorState:=true;
|
||||||
|
ErrorMessage:=AThread.ErrorMessage;
|
||||||
Finished:=true;
|
Finished:=true;
|
||||||
|
end;
|
||||||
AThread.APackage := nil;
|
AThread.APackage := nil;
|
||||||
end;
|
end;
|
||||||
StartI := I;
|
StartI := I;
|
||||||
@ -5839,6 +5847,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
{$ifndef NO_THREADING}
|
{$ifndef NO_THREADING}
|
||||||
// Use worker-threads to compile the packages
|
// Use worker-threads to compile the packages
|
||||||
|
ErrorState := False;
|
||||||
Finished := False;
|
Finished := False;
|
||||||
I := 0;
|
I := 0;
|
||||||
// This event is set by the worker-threads to notify the main/this thread
|
// This event is set by the worker-threads to notify the main/this thread
|
||||||
@ -5870,6 +5879,8 @@ begin
|
|||||||
for thr:=0 to Defaults.ThreadsAmount-1 do
|
for thr:=0 to Defaults.ThreadsAmount-1 do
|
||||||
Threads[Thr].Free;
|
Threads[Thr].Free;
|
||||||
end;
|
end;
|
||||||
|
if ErrorState then
|
||||||
|
raise Exception.Create(ErrorMessage);
|
||||||
{$endif NO_THREADING}
|
{$endif NO_THREADING}
|
||||||
end;
|
end;
|
||||||
If Assigned(AfterCompile) then
|
If Assigned(AfterCompile) then
|
||||||
|
Loading…
Reference in New Issue
Block a user