IDE: Move func param ExtraOptions to private var in TLazarusBuilder.

git-svn-id: trunk@44040 -
This commit is contained in:
juha 2014-02-13 15:53:16 +00:00
parent bd70110613
commit 3f45e5c0a6

View File

@ -154,12 +154,13 @@ type
TLazarusBuilder = class TLazarusBuilder = class
private private
fExtraOptions: string;
fUpdateRevInc: boolean; fUpdateRevInc: boolean;
fOutputDirRedirected: boolean; fOutputDirRedirected: boolean;
fTargetFilename: string; fTargetFilename: string;
function CreateIDEMakeOptions(Profile: TBuildLazarusProfile; function CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string; Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; out ExtraOptions: string): TModalResult; Flags: TBuildLazarusFlags): TModalResult;
function IsWriteProtected(Profile: TBuildLazarusProfile): Boolean; function IsWriteProtected(Profile: TBuildLazarusProfile): Boolean;
public public
function ShowConfigureBuildLazarusDlg(AProfiles: TBuildLazarusProfiles): TModalResult; function ShowConfigureBuildLazarusDlg(AProfiles: TBuildLazarusProfiles): TModalResult;
@ -366,7 +367,6 @@ var
end; end;
var var
ExtraOptions: String;
IdeBuildMode: TIdeBuildMode; IdeBuildMode: TIdeBuildMode;
Dir: String; Dir: String;
Cmd: String; Cmd: String;
@ -462,15 +462,15 @@ begin
else else
Cmd:='cleanide ide'; Cmd:='cleanide ide';
// append extra Profile // append extra Profile
ExtraOptions:=''; fExtraOptions:='';
Result:=CreateIDEMakeOptions(Profile,Macros,PackageOptions,Flags,ExtraOptions); Result:=CreateIDEMakeOptions(Profile,Macros,PackageOptions,Flags);
if Result<>mrOk then exit; if Result<>mrOk then exit;
if (not fOutputDirRedirected) and (not CheckDirectoryWritable(WorkingDirectory)) then if (not fOutputDirRedirected) and (not CheckDirectoryWritable(WorkingDirectory)) then
exit(mrCancel); exit(mrCancel);
if ExtraOptions<>'' then if fExtraOptions<>'' then
EnvironmentOverrides.Values['OPT'] := ExtraOptions; EnvironmentOverrides.Values['OPT'] := fExtraOptions;
if not fUpdateRevInc then begin if not fUpdateRevInc then begin
CheckRevisionInc; CheckRevisionInc;
EnvironmentOverrides.Values['USESVN2REVISIONINC'] := '0'; EnvironmentOverrides.Values['USESVN2REVISIONINC'] := '0';
@ -499,7 +499,7 @@ end;
function TLazarusBuilder.CreateIDEMakeOptions(Profile: TBuildLazarusProfile; function TLazarusBuilder.CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
Macros: TTransferMacroList; const PackageOptions: string; Macros: TTransferMacroList; const PackageOptions: string;
Flags: TBuildLazarusFlags; out ExtraOptions: string): TModalResult; Flags: TBuildLazarusFlags): TModalResult;
procedure BackupExe(var ExeFilename: string); procedure BackupExe(var ExeFilename: string);
var var
@ -560,13 +560,13 @@ function TLazarusBuilder.CreateIDEMakeOptions(Profile: TBuildLazarusProfile;
procedure AppendExtraOption(const AddOption: string; EncloseIfSpace: boolean); procedure AppendExtraOption(const AddOption: string; EncloseIfSpace: boolean);
begin begin
if AddOption='' then exit; if AddOption='' then exit;
if ExtraOptions<>'' then if fExtraOptions<>'' then
ExtraOptions:=ExtraOptions+' '; fExtraOptions:=fExtraOptions+' ';
if EncloseIfSpace and (Pos(' ',AddOption)>0) then if EncloseIfSpace and (Pos(' ',AddOption)>0) then
ExtraOptions:=ExtraOptions+'"'+AddOption+'"' fExtraOptions:=fExtraOptions+'"'+AddOption+'"'
else else
ExtraOptions:=ExtraOptions+AddOption; fExtraOptions:=fExtraOptions+AddOption;
//DebugLn(['AppendExtraOption ',ExtraOptions]); //DebugLn(['AppendExtraOption ',fExtraOptions]);
end; end;
procedure AppendExtraOption(const AddOption: string); procedure AppendExtraOption(const AddOption: string);
@ -595,7 +595,7 @@ begin
fUpdateRevInc:=Profile.UpdateRevisionInc; fUpdateRevInc:=Profile.UpdateRevisionInc;
// create extra Profile // create extra Profile
ExtraOptions:=Profile.ExtraOptions; fExtraOptions:=Profile.ExtraOptions;
// check for special IDE config file // check for special IDE config file
if (blfUseMakeIDECfg in Flags) then begin if (blfUseMakeIDECfg in Flags) then begin
@ -792,19 +792,18 @@ begin
end; end;
// add package Profile for IDE // add package Profile for IDE
//DebugLn(['CreateBuildLazarusOptions blfUseMakeIDECfg=',blfUseMakeIDECfg in FLags,' ExtraOptions="',ExtraOptions,'" ',PackageOptions]); //DebugLn(['CreateBuildLazarusOptions blfUseMakeIDECfg=',blfUseMakeIDECfg in FLags,' ExtraOptions="',fExtraOptions,'" ',PackageOptions]);
if not (blfUseMakeIDECfg in Flags) then if not (blfUseMakeIDECfg in Flags) then
AppendExtraOption(PackageOptions,false); AppendExtraOption(PackageOptions,false);
//DebugLn(['CreateBuildLazarusOptions ',MMDef.Name,' ',ExtraOptions]); //DebugLn(['CreateBuildLazarusOptions ',MMDef.Name,' ',fExtraOptions]);
end; end;
function TLazarusBuilder.IsWriteProtected(Profile: TBuildLazarusProfile): Boolean; function TLazarusBuilder.IsWriteProtected(Profile: TBuildLazarusProfile): Boolean;
// Returns True if Lazarus installation directory is write protected. Now uses OutputDirRedirected info. // Returns True if Lazarus installation directory is write protected. Now uses OutputDirRedirected info.
var var
ExOptions, LazExeFilename: String;
ModRes: TModalResult; ModRes: TModalResult;
begin begin
ModRes := CreateIDEMakeOptions(Profile, GlobalMacroList, '', [], ExOptions); ModRes := CreateIDEMakeOptions(Profile, GlobalMacroList, '', []);
if ModRes in [mrOk,mrIgnore] then if ModRes in [mrOk,mrIgnore] then
Result := fOutputDirRedirected Result := fOutputDirRedirected
else else
@ -864,21 +863,20 @@ function TLazarusBuilder.SaveIDEMakeOptions(Profile: TBuildLazarusProfile;
end; end;
var var
ExOptions: String;
Filename: String; Filename: String;
fs: TFileStreamUTF8; fs: TFileStreamUTF8;
OptionsAsText: String; OptionsAsText: String;
begin begin
ExOptions:=''; fExtraOptions:='';
Result:=CreateIDEMakeOptions(Profile, Macros, PackageOptions, Flags, ExOptions); Result:=CreateIDEMakeOptions(Profile, Macros, PackageOptions, Flags);
if Result<>mrOk then exit; if Result<>mrOk then exit;
Filename:=GetMakeIDEConfigFilename; Filename:=GetMakeIDEConfigFilename;
try try
InvalidateFileStateCache; InvalidateFileStateCache;
fs:=TFileStreamUTF8.Create(Filename,fmCreate); fs:=TFileStreamUTF8.Create(Filename,fmCreate);
try try
if ExOptions<>'' then begin if fExtraOptions<>'' then begin
OptionsAsText:=BreakOptions(ExOptions); OptionsAsText:=BreakOptions(fExtraOptions);
fs.Write(OptionsAsText[1],length(OptionsAsText)); fs.Write(OptionsAsText[1],length(OptionsAsText));
end; end;
finally finally