mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-11 05:07:56 +02:00
LazBuild: read pcp from lazarus.cfg file
git-svn-id: trunk@43687 -
This commit is contained in:
parent
11ed2bfba4
commit
1e3565dae3
@ -78,6 +78,7 @@ function GetCfgFileContent: TStrings;
|
||||
function GetParamsAndCfgFile: TStrings;
|
||||
function ParamsAndCfgCount: Integer;
|
||||
function ParamsAndCfgStr(Idx: Integer): String;
|
||||
procedure ResetParamsAndCfg;
|
||||
|
||||
|
||||
implementation
|
||||
@ -153,6 +154,11 @@ begin
|
||||
Result := GetParamsAndCfgFile[Idx];
|
||||
end;
|
||||
|
||||
procedure ResetParamsAndCfg;
|
||||
begin
|
||||
FreeAndNil(ParamsAndCfgFileContent);
|
||||
end;
|
||||
|
||||
procedure ParseCommandLine(aCmdLineParams: TStrings; out IDEPid: Integer; out
|
||||
ShowSplashScreen: boolean);
|
||||
const
|
||||
|
@ -98,6 +98,9 @@ type
|
||||
{%H-}DlgType: TMsgDlgType; {%H-}Buttons: array of const;
|
||||
const {%H-}HelpKeyword: string): Integer;
|
||||
protected
|
||||
function GetParams(Index: Integer): String; override;
|
||||
function GetParamCount: Integer; override;
|
||||
|
||||
// Builds project or package, depending on extension.
|
||||
// Packages can also be specified by package name if they are known to the IDE.
|
||||
function BuildFile(Filename: string): boolean;
|
||||
@ -177,6 +180,48 @@ const
|
||||
ErrorLoadProjectFailed = 5;
|
||||
VersionStr = {$I version.inc};
|
||||
|
||||
procedure FilterConfigFileContent;
|
||||
var
|
||||
l: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
ResetParamsAndCfg;
|
||||
l := GetCfgFileContent;
|
||||
i := l.Count - 1;
|
||||
while i >= 0 do begin
|
||||
if not(
|
||||
(copy(l[i], 1, 22) = '--primary-config-path=') or
|
||||
(copy(l[i], 1, 24) = '--secondary-config-path=') or
|
||||
(copy(l[i], 1, 6) = '--pcp=') or
|
||||
(copy(l[i], 1, 6) = '--scp=')
|
||||
)
|
||||
then
|
||||
l.Delete(i);
|
||||
dec(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
Function ParamCount: Integer;
|
||||
begin
|
||||
Result := GetParamsAndCfgFile.Count - 1;
|
||||
end;
|
||||
|
||||
Function Paramstr(Param : Integer) : Ansistring;
|
||||
begin
|
||||
if Param >= GetParamsAndCfgFile.Count then
|
||||
Result := ''
|
||||
else
|
||||
Result := GetParamsAndCfgFile[Param];
|
||||
end;
|
||||
|
||||
Function ParamStrUTF8(Param : Integer) : Ansistring;
|
||||
begin
|
||||
if Param >= GetParamsAndCfgFile.Count then
|
||||
Result := ''
|
||||
else
|
||||
Result := GetParamsAndCfgFile[Param];
|
||||
end;
|
||||
|
||||
procedure GetDescriptionOfDependencyOwner(Dependency: TPkgDependency;
|
||||
out Description: string);
|
||||
var
|
||||
@ -314,6 +359,19 @@ begin
|
||||
Result:=mrCancel;
|
||||
end;
|
||||
|
||||
function TLazBuildApplication.GetParams(Index: Integer): String;
|
||||
begin
|
||||
if Index >= GetParamsAndCfgFile.Count then
|
||||
Result := ''
|
||||
else
|
||||
Result := GetParamsAndCfgFile[Index];
|
||||
end;
|
||||
|
||||
function TLazBuildApplication.GetParamCount: Integer;
|
||||
begin
|
||||
Result := GetParamsAndCfgFile.Count - 1;
|
||||
end;
|
||||
|
||||
function TLazBuildApplication.BuildFile(Filename: string): boolean;
|
||||
var
|
||||
OriginalFilename: string;
|
||||
@ -1618,6 +1676,7 @@ begin
|
||||
{$IFDEF BuildWidgetSetCocoa} Result:=lpCocoa; {$ENDIF}
|
||||
{$IFDEF BuildWidgetSetNoGui} Result:=lpNoGUI; {$ENDIF}
|
||||
|
||||
FilterConfigFileContent;
|
||||
// free LCL application
|
||||
FreeAndNil(Forms.Application);
|
||||
// start our own application
|
||||
|
Loading…
Reference in New Issue
Block a user