mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 08:49:25 +02:00
* Added some functionality to create configuration-files
git-svn-id: trunk@36375 -
This commit is contained in:
parent
188ec0f0c7
commit
59e0ca7278
@ -126,6 +126,8 @@ Type
|
|||||||
procedure SetPrefix(AValue: string);
|
procedure SetPrefix(AValue: string);
|
||||||
procedure SetRepositoryName(AValue: string);
|
procedure SetRepositoryName(AValue: string);
|
||||||
procedure SetPath(AValue: string);
|
procedure SetPath(AValue: string);
|
||||||
|
protected
|
||||||
|
procedure SaveToStrings(AStrings: TStrings); override;
|
||||||
public
|
public
|
||||||
procedure AddKeyValue(const AKey, AValue: string); override;
|
procedure AddKeyValue(const AKey, AValue: string); override;
|
||||||
procedure LogValues(ALogLevel: TLogLevel); override;
|
procedure LogValues(ALogLevel: TLogLevel); override;
|
||||||
@ -202,6 +204,8 @@ Type
|
|||||||
|
|
||||||
procedure BindToCompilerOptions(ACompilerOptions: TCompilerOptions);
|
procedure BindToCompilerOptions(ACompilerOptions: TCompilerOptions);
|
||||||
procedure AddRepositoriesForCompilerSettings(ACompilerOptions: TCompilerOptions);
|
procedure AddRepositoriesForCompilerSettings(ACompilerOptions: TCompilerOptions);
|
||||||
|
function AddRepositoryOptionSection(ASectionClass: TFppkgRepositoryOptionSectionClass): TFppkgRepositoryOptionSection;
|
||||||
|
function AddIncludeFilesOptionSection(AFileMask: string): TFppkgIncludeFilesOptionSection;
|
||||||
|
|
||||||
property SectionList: TFppkgOptionSectionList read GetSectionList;
|
property SectionList: TFppkgOptionSectionList read GetSectionList;
|
||||||
property GlobalSection: TFppkgGLobalOptionSection read GetGlobalSection;
|
property GlobalSection: TFppkgGLobalOptionSection read GetGlobalSection;
|
||||||
@ -437,6 +441,18 @@ begin
|
|||||||
FPath := fpmkunit.FixPath(AValue, True);
|
FPath := fpmkunit.FixPath(AValue, True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFppkgRepositoryOptionSection.SaveToStrings(AStrings: TStrings);
|
||||||
|
begin
|
||||||
|
inherited SaveToStrings(AStrings);
|
||||||
|
AStrings.Add('['+KeyRepositorySection+']');
|
||||||
|
AStrings.Add(KeyRepositoryName+'='+RepositoryName);
|
||||||
|
AStrings.Add(KeyRepositoryDescription+'='+Description);
|
||||||
|
AStrings.Add(KeyRepositoryPath+'='+FPath);
|
||||||
|
AStrings.Add(KeyRepositoryPrefix+'='+FPrefix);
|
||||||
|
if InstallRepositoryName<>'' then
|
||||||
|
AStrings.Add(KeyInstallRepositoryName+'='+InstallRepositoryName);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFppkgRepositoryOptionSection.AddKeyValue(const AKey, AValue: string);
|
procedure TFppkgRepositoryOptionSection.AddKeyValue(const AKey, AValue: string);
|
||||||
begin
|
begin
|
||||||
if SameText(AKey,KeyRepositoryName) then
|
if SameText(AKey,KeyRepositoryName) then
|
||||||
@ -827,12 +843,24 @@ procedure TFppkgOptions.SaveToFile(const AFileName: string);
|
|||||||
var
|
var
|
||||||
IniFile: TStringList;
|
IniFile: TStringList;
|
||||||
CurrentSection: TFppkgOptionSection;
|
CurrentSection: TFppkgOptionSection;
|
||||||
|
GSection: TFppkgGlobalOptionSection;
|
||||||
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
IniFile:=TStringList.Create;
|
IniFile:=TStringList.Create;
|
||||||
try
|
try
|
||||||
// Only the Global-section is being written, with some default values
|
GSection := GlobalSection;
|
||||||
CurrentSection := GlobalSection;
|
GSection.SaveToStrings(IniFile);
|
||||||
CurrentSection.SaveToStrings(IniFile);
|
|
||||||
|
for i := 0 to SectionList.Count-1 do
|
||||||
|
begin
|
||||||
|
CurrentSection := SectionList[i];
|
||||||
|
if CurrentSection<>GSection then
|
||||||
|
begin
|
||||||
|
IniFile.Add('');
|
||||||
|
CurrentSection.SaveToStrings(IniFile);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
Inifile.SaveToFile(AFileName);
|
Inifile.SaveToFile(AFileName);
|
||||||
finally
|
finally
|
||||||
Inifile.Free;
|
Inifile.Free;
|
||||||
@ -898,6 +926,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFppkgOptions.AddRepositoryOptionSection(ASectionClass: TFppkgRepositoryOptionSectionClass): TFppkgRepositoryOptionSection;
|
||||||
|
begin
|
||||||
|
Result := ASectionClass.Create(FOptionParser);
|
||||||
|
FSectionList.Add(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFppkgOptions.AddIncludeFilesOptionSection(AFileMask: string): TFppkgIncludeFilesOptionSection;
|
||||||
|
begin
|
||||||
|
Result := TFppkgIncludeFilesOptionSection.Create(FOptionParser, Self, AFileMask);
|
||||||
|
FSectionList.Add(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TCompilerOptions
|
TCompilerOptions
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
Loading…
Reference in New Issue
Block a user