codetools: added IsPas2jsTargetOS IsPas2jsTargetCPU, removed deprecated functions

git-svn-id: trunk@60590 -
This commit is contained in:
mattias 2019-03-05 09:43:24 +00:00
parent 8fe77a05b7
commit 9f27095fee

View File

@ -853,8 +853,6 @@ type
property ChangeStamp: integer read FChangeStamp;
end;
TFPCTargetConfigCache = TPCTargetConfigCache deprecated 'use TPCTargetConfigCache'; // Laz 1.9
{ TPCTargetConfigCaches
List of TPCTargetConfigCache }
@ -885,8 +883,6 @@ type
property ExtraOptions: string read FExtraOptions write FExtraOptions; // additional compiler options not used as key, e.g. -Fr<language file>
end;
TFPCTargetConfigCaches = TPCTargetConfigCaches deprecated 'use TPCTargetConfigCaches'; // Laz 1.9
TFPCSourceCaches = class;
{ TFPCSourceCache
@ -1069,6 +1065,8 @@ function GetDefaultCompilerFilename(const TargetCPU: string = ''; Cross: boolean
procedure GetTargetProcessors(const TargetCPU: string; aList: TStrings);
function GetFPCTargetOS(TargetOS: string): string; // normalize
function GetFPCTargetCPU(TargetCPU: string): string; // normalize
function IsPas2jsTargetOS(TargetOS: string): boolean;
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean; // not thread-safe
@ -3852,6 +3850,18 @@ begin
Result:=LowerCase(TargetCPU);
end;
function IsPas2jsTargetOS(TargetOS: string): boolean;
begin
TargetOS:=LowerCase(TargetOS);
Result:=(TargetOS='browser') or (TargetOS='nodejs');
end;
function IsPas2jsTargetCPU(TargetCPU: string): boolean;
begin
TargetCPU:=LowerCase(TargetCPU);
Result:=Pos('ecmascript',TargetCPU)>0;
end;
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean;
begin
Result:=false;
@ -8819,10 +8829,11 @@ begin
CompilerDate:=-1;
if FileExistsCached(Compiler) then begin
CompilerDate:=FileAgeCached(Compiler);
ExtraOptions:=GetFPCInfoCmdLineOptions(ExtraOptions);// contains TargetOS and TargetCPU
ExtraOptions:=GetFPCInfoCmdLineOptions(ExtraOptions);// add -TTargetOS and -PTargetCPU
BaseDir:='';
// get version, OS and CPU
// check if this is a FPC compatible compiler and get version, OS and CPU
// Note: fpc.exe calls the real compiler depending on -T and -P
InfoTypes:=[fpciTargetOS,fpciTargetProcessor,fpciFullVersion];
Info:=RunFPCInfo(Compiler,InfoTypes,ExtraOptions);
if ParseFPCInfo(Info,InfoTypes,Infos) then begin