LazBuild: read pcp from lazarus.cfg file

git-svn-id: trunk@43687 -
This commit is contained in:
martin 2014-01-10 14:34:43 +00:00
parent 11ed2bfba4
commit 1e3565dae3
2 changed files with 65 additions and 0 deletions

View File

@ -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

View File

@ -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